Bug 1055293 - RFE: postgis-upgrade: build postgis against postgresql-upgrade-devel
Summary: RFE: postgis-upgrade: build postgis against postgresql-upgrade-devel
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: postgis
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Pavel Raiskup
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1342285 (view as bug list)
Depends On: 1475177
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-01-19 23:34 UTC by Joakim Verona
Modified: 2017-10-26 14:31 UTC (History)
11 users (show)

Fixed In Version: postgis-2.4.1-2.fc28
Clone Of:
Environment:
Last Closed: 2017-10-18 16:29:47 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
adding function necessary for upgrade (5.81 KB, patch)
2015-01-16 09:07 UTC, Jozef Mlich
no flags Details | Diff
adding -devel subpackage to postgresql (headers and so) necessary to compile postgis against previous version (2.74 KB, patch)
2015-01-16 09:08 UTC, Jozef Mlich
no flags Details | Diff

Description Joakim Verona 2014-01-19 23:34:14 UTC
Description of problem:

When upgrading fedora 19 to 20, postgres + postgis, upgrade fails.

pg_dump: [archiver (db)] query failed: ERROR:  could not access file "$libdir/postgis-2.0": No such file or directory

It seems the upgrade script needs an earlier version of postgis installed in parallell, but the upgrade removes this.


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Devrim Gündüz 2014-01-23 08:14:18 UTC
This is what I already fixed in the community RPMS :( I will try to apply the same patch to Fedora RPMS.

Comment 2 Joakim Verona 2014-01-23 22:11:26 UTC
Do you have a pointer to the patch?

Comment 3 Jozef Mlich 2015-01-16 09:07:27 UTC
Created attachment 980790 [details]
adding function necessary for upgrade

Comment 4 Jozef Mlich 2015-01-16 09:08:03 UTC
Created attachment 980791 [details]
adding -devel subpackage to postgresql (headers and so) necessary to compile postgis against previous version

Comment 5 Fedora End Of Life 2015-05-29 10:35:12 UTC
This message is a reminder that Fedora 20 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 20. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '20'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 20 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 6 Jozef Mlich 2015-05-30 08:11:47 UTC
I think this is working for most of cases. However, the simultaneous upgrade of postgis and postgresql will fail. I.e. the .so from postgis-upgrade package must be build against postgresql-upgrade-devel package which doesn't currently exists in fedora. 

It seems to be reasonable to track this issue in future. Especially, when the patch is attached.

The workaround is to use right version of postgis.so from community repos.

Comment 7 Tobias Schönberg 2017-05-09 19:21:26 UTC
I just ran into this issue upgrading from Fedora 25 to 26. The postgresql service does not start anymore after the update:

When looking at the status of the failed service it suggests:

> postgresql-setup --upgrade

The pg_upgrade tool fails and directs me to the upgrade log. And that directs to the more detailed log that contains:

> pg_dump: [archiver (db)] query failed: ERROR:  could not access file "$libdir/postgis-2.2": No such file or directory

In Fedora 26 the version of postgis is 2.3.2.

Comment 8 Pavel Raiskup 2017-07-26 07:30:59 UTC
*** Bug 1342285 has been marked as a duplicate of this bug. ***

Comment 9 Dave Allan 2017-08-30 13:49:44 UTC
I also hit this upgrading 25->26

Comment 10 Dave Allan 2017-08-31 04:11:03 UTC
For the record, was able to upgrade as follows.  I (possibly unnecessarily) installed 9.5 from upstream source into /opt, installed postgis 2.2 and 2.3 into that postgres installation, started postgres with my existing databases using that installation, upgraded postgis in all my databases to 2.3, then manually ran the distro packaged pg_update, which succeeded, and after which the system postgres was able to start.  There may be an easier way to do it.

See:

https://www.postgresql.org/docs/9.6/static/pgupgrade.html
http://postgis.net/install/

and some additional information at:

http://blog.cleverelephant.ca/2016/08/postgis-upgrade.html

Comment 11 Fabrice Salvaire 2017-10-08 12:32:02 UTC
Same for me, hopefully PostgreSQL is a professional database ...

Old pg 9.5 is in /usr/lib64/pgsql/postgresql-9.5

But Fedora don't ship pg_config nor includes, nice to compile extensions !!!

My old test dababase used a folk of Postgis 2.1 and 2.2

I tried to compile / hack Postgis 2.1, but I failed to match pg version

hack because json-c and postgres are not compatible with 2.1

Lucky, I backuped my old system, so I get back postgis-2.1.so and installed it to /usr/lib64/pgsql/postgresql-9.5/lib. I had also to install an older proj4 library.

Then I tried to upgrade, but it never ended for some reasons ???

So I started pg 9.5 using

su postgres
/usr/lib64/pgsql/postgresql-9.5/bin/postgres -D /var/lib/pgsql-backup/data -p 5432 -h '*' &

And dumped my databases using

pg_dump -p 5432 -h 127.0.0.1 XXXX

Finally, I Lost 3 hours ! My advice, dump your database before to upgrade.

Comment 13 clifford snow 2017-10-08 16:29:43 UTC
same problem upgrading from 25 to 26

Comment 14 Pavel Raiskup 2017-10-11 05:55:36 UTC
This RFE is unlikely to happen for F25 -> F26 transition, but since there's
new PostgreSQL major version in F28, we should be OK to have upgrade-path
for PostGIS + PostgreSQL in F27 -> F28 time.

In private branch is PoC:
https://src.fedoraproject.org/rpms/postgis/commits/private-praiskup-postgis-upgrade

Any test/comment is welcome.

Comment 15 Pavel Raiskup 2017-10-11 05:57:35 UTC
In the meantime (F25 -> F26) please go the 'hard upgrade' way:
https://postgis.net/docs/postgis_installation.html#hard_upgrade

Comment 16 Pavel Raiskup 2017-10-11 05:58:43 UTC
Complement for #14, testing build is here:
https://copr.fedorainfracloud.org/coprs/praiskup/postgresql-10/

Comment 17 Pavel Raiskup 2017-10-12 11:00:52 UTC
I updated the private branch once more (per Honza's/Petr's) comment, so
that now the %postgresql_upgrade_prefix is defined in postgresql-upgrade-devel,
and we don't have to hardcode the path into <plugin>-upgrade package.

I rebuilt the server/plugin in the testing copr, and then I tried to:

  1. export small part of openstreetmaps map into map.osm
  2. import that into testing database v9.6 by osm2pgsql (thanks to pkubat
     for the howto)
  3. install 'postgis-upgrade' (transitively installs postgresql-upgrade)
  4. hit 'postgresql-setup --upgrade' + start the new service
  5. remove 'postresql-upgrade' (removes also postgis-upgrade, those
     packages are not needed anymore)
  6. manually run 'alter extension postgis update;'

And the upgrade scenario went smoothly from PostgreSQL 9.6 to PostgreSQL 10,
while upgrading from PostGIS 2.3 to PostGIS 2.4 at the same time.

Comment 18 Pavel Raiskup 2017-10-18 16:29:47 UTC
And it is now built in Rawhide:
https://koji.fedoraproject.org/koji/buildinfo?buildID=986189

Built from:
https://src.fedoraproject.org/rpms/postgis/blob/bc43e98a0b64dc48163e908a050f9e0cc0857f5c/f/postgis.spec

There are non-trivial changes, so any review/test/bugreport is really
welcome, rather sooner than later.

Comment 19 Dave Allan 2017-10-18 16:54:02 UTC
If I install F27Beta then DNF system upgrade to rawhide, would that be a valid test?

Comment 20 Pavel Raiskup 2017-10-18 17:04:54 UTC
(In reply to Dave Allan from comment #19)
> If I install F27Beta then DNF system upgrade to rawhide, would that be a
> valid test?

Yes, F27 has PostgreSQL 9.6 + PostGIS 2.3.3, while F28 (Rawhide) has
PostgreSQL 10 + PostGIS 2.4.0.  Don't forget to install 'postgis-upgrade'
package.

Comment 21 Dave Allan 2017-10-25 17:49:24 UTC
I'm getting a failure attempting to install postgis-upgrade.

Steps I took:
1) install F27Beta and confirm a working postgis instance
2) dnf system-upgrade to rawhide
3) dnf install postgresql-upgrade (forgetting to install postgis-upgrade)
4) dnf install postgis-upgrade
Error: 
 Problem: conflicting requests
  - nothing provides liblwgeom-2.3.so.0()(64bit) needed by postgis-upgrade-2.4.1-1.fc28.x86_64

Comment 22 Pavel Raiskup 2017-10-26 12:03:50 UTC
Thank you for the test, Dave.  It should be now fixed by:

https://src.fedoraproject.org/rpms/postgis/c/47ea3f594d822c41d7e129c8a4b310d33157b5e6?branch=master

Comment 23 Dave Allan 2017-10-26 13:20:13 UTC
Ok, I'm able to install postgis, postgis-utils and postgis-upgrade from that link.  postgresql-setup --upgrade then succeeds and I'm able to start postgres and upgrade postgis.  The only remaining question I have is that I get this error when attempting to update the address standardizer:

gistest=# alter extension address_standardizer update;
ERROR:  extension "address_standardizer" has no update path from version "2.3.3" to version "2.4.1"

Dropping the extension and recreating it installs 2.4.1.  I don't normally use the address standardizer, so I don't know if this is correct behavior.

Comment 24 Pavel Raiskup 2017-10-26 13:46:10 UTC
Hm, the address_standardizer--2.3.3--2.4.1.sql is missing:

# rpm -ql postgis | grep 2.3.3 | grep sql$
/usr/share/pgsql/extension/postgis--2.3.3--2.4.1.sql
/usr/share/pgsql/extension/postgis_tiger_geocoder--2.3.3--2.4.1.sql
/usr/share/pgsql/extension/postgis_topology--2.3.3--2.4.1.sql

I'm not sure whether this doesn't deserve separate issue (maybe even 
upstream).

All the plugins' Makefiles (except for address_standardizer's one) do:

  for OLD_VERSION in $(UPGRADEABLE_VERSIONS);
  ...

Workaround could be:
ln /usr/share/pgsql/extension/address_standardizer--1.0--2.4.1.sql \
   /usr/share/pgsql/extension/address_standardizer--2.3.3--2.4.1.sql

Comment 25 Dave Allan 2017-10-26 14:31:52 UTC
Yeah, question for upstream if anything.  Anyway, the upgrade path now works for me, so thanks for the fix.


Note You need to log in before you can comment on or make changes to this bug.