emerge Postgresql 8.1.0 don't check previously installed version of postgresql and leave system in a unusable state if PostgreSQL 8.0.x is installed. Since PostgreSQL 8.1.0 is unable to upgrade from db of 8.0.x, emerge should be blocked until user perform a full dump of database and unmerge previous version. Current ebuild allows the emerge to continue and it results in a unusable postgres 8.1.0. Log of postgresql-8.1 after "upgrade": FATAL: database files are incompatible with server DETAIL: The data directory was initialized by PostgreSQL version 8.0, which is not compatible with this version 8.1.0.
Created attachment 72814 [details, diff] Proposed patch against ebuild This should check for a 8.1.x before executing upgrade
just a small add to be "clear": unmerge is not enough, deleting the left over data files is needed as well. The pkg_setup actually checks this directory...so it's cool... and honestly, this thing should be done by the user...
Honestly, the ebuild should check against ${PGDATA}/PG_VERSION, which is set in /etc/conf.d/postgresql - not against a patch hardcoded in the ebuild, so that the check actually works for people that don't use the default location for pgsql databases.
Created attachment 72835 [details, diff] 2nd version of patch This one try to figure out the $PG_DIR using the /etc/conf.d/postgres file (since, at least on my system, the PGDATA is not set) Side effect: the config part will actually create the data dir on the location given in /etc/conf.d/postgresql
typo in comment: /etc/conf.d/postgres is /etc/conf.d/postgresql ...
Can we get a fix for this? This is quite clearly a bug in the ebuild (${PG_MINOR} -lt 0 ?? That'll work well for anyone upgrading from 8.-1 or earlier...). Either fix it or mask it.
fixed. I have not applyed the patch in comment #4 yet. I'll looking into it later.
Thanks for the fix Btw, since the check seems fine for me and will work for "most of people config", I passed it to "enhancement" severity... As far as I am concerned, it can be closed too. Up to Jakub/Masatomo/others to decide
Closing this, as the actual ebuilds perform the needed check and have PG_DIR correctly defined. Best regards, CHTEKK.