Thread: BUG #13646: Upgrading existing db from 9.2 to 9.4.4 not working using postgresql-setup.

BUG #13646: Upgrading existing db from 9.2 to 9.4.4 not working using postgresql-setup.

From
jwhiting@redhat.com
Date:
The following bug has been logged on the website:

Bug reference:      13646
Logged by:          Jeremy Whiting
Email address:      jwhiting@redhat.com
PostgreSQL version: 9.4.4
Operating system:   Fedora 22, Linux burtha-f22 4.1.6-200.fc22.x86_64
Description:

Hi,
 I have been trying to upgrade a database created using 9.2.0. Using the
postgresql-setup version 9.4.4. This issue happens on two machines both
running Fedora 22.

 After installing the "PostgreSQL Yum Repository" for Fedora 22 I followed
the instructions to start the database. This error message was displayed
when starting.

$ sudo service postgresql startRedirecting to /bin/systemctl start
postgresql.service
Job for postgresql.service failed. See "systemctl status postgresql.service"
and "journalctl -xe" for details.

Using journalctl -xe I found this message indicating an error.

Sep 28 09:10:11 burtha-f22 systemd[1]: Starting PostgreSQL database
server...
-- Subject: Unit postgresql.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit postgresql.service has begun starting up.
Sep 28 09:10:11 burtha-f22 postgresql-check-db-dir[27169]: An old version of
the database format was found.
Sep 28 09:10:11 burtha-f22 postgresql-check-db-dir[27169]: Use
"postgresql-setup --upgrade" to upgrade to version 9.4.
Sep 28 09:10:11 burtha-f22 postgresql-check-db-dir[27169]: See
/usr/share/doc/postgresql/README.rpm-dist for more information.
Sep 28 09:10:11 burtha-f22 systemd[1]: postgresql.service: control process
exited, code=exited status=1
Sep 28 09:10:11 burtha-f22 systemd[1]: Failed to start PostgreSQL database
server.

 Which says an old database was found. I followed the instructions to use
the tool postgresql-setup with the flag --upgrade to complete the upgrade.
But that did not work. I see this message.

$ postgresql-setup --upgrade
 * Upgrading database.
ERROR: failed
 * See /var/lib/pgsql/upgrade_postgresql.log for details.

 Checking the file using cat I see this

$ cat /var/lib/pgsql/upgrade_postgresql.log
$

 meaning it is empty. The file was opened to be written but nothing was
written to the file.

$ date
Mon 28 Sep 09:47:13 BST 2015
$ ls -l /var/lib/pgsql/upgrade_postgresql.log
-rw-------. 1 postgres postgres 0 Sep 28 09:30
/var/lib/pgsql/upgrade_postgresql.log

 I was expecting to see some indication of the problem in
upgrade_postgresql.log
 to help troubleshoot further.

 Not finding any this report has been generated because other users may come
across the same issue.
jwhiting@redhat.com writes:
> The following bug has been logged on the website:
> Bug reference:      13646
> Logged by:          Jeremy Whiting
> Email address:      jwhiting@redhat.com
> PostgreSQL version: 9.4.4
> Operating system:   Fedora 22, Linux burtha-f22 4.1.6-200.fc22.x86_64
> Description:

> Hi,
>  I have been trying to upgrade a database created using 9.2.0. Using the
> postgresql-setup version 9.4.4. This issue happens on two machines both
> running Fedora 22.

You would be better off filing this in Red Hat's bugzilla, because
postgresql-setup is Red Hat's code not the PG community's.  However,
I think what you'll be told is that postgresql-setup isn't intended to
handle upgrades across more than one major Postgres version.  It certainly
wouldn't have been able to when I worked there, because it's only packaged
with a postmaster executable for the immediately preceding major Postgres
version.

Perhaps you can persuade the guys to redesign the packaging to handle
such cases, but here is not where to ask for it.

            regards, tom lane
Hi Tom,
  Thank you for the background. If I need to take it further then I'll
do as you suggest.

Kind regards,
Jeremy

On 28/09/15 14:38, Tom Lane wrote:
> jwhiting@redhat.com writes:
>> The following bug has been logged on the website:
>> Bug reference:      13646
>> Logged by:          Jeremy Whiting
>> Email address:      jwhiting@redhat.com
>> PostgreSQL version: 9.4.4
>> Operating system:   Fedora 22, Linux burtha-f22 4.1.6-200.fc22.x86_64
>> Description:
>> Hi,
>>   I have been trying to upgrade a database created using 9.2.0. Using the
>> postgresql-setup version 9.4.4. This issue happens on two machines both
>> running Fedora 22.
> You would be better off filing this in Red Hat's bugzilla, because
> postgresql-setup is Red Hat's code not the PG community's.  However,
> I think what you'll be told is that postgresql-setup isn't intended to
> handle upgrades across more than one major Postgres version.  It certainly
> wouldn't have been able to when I worked there, because it's only packaged
> with a postmaster executable for the immediately preceding major Postgres
> version.
>
> Perhaps you can persuade the guys to redesign the packaging to handle
> such cases, but here is not where to ask for it.
>
>             regards, tom lane