Обсуждение: upgrade from 13 to 16

Поиск
Список
Период
Сортировка

upgrade from 13 to 16

От
listy
Дата:
Hi guys.

Is upgrade from ver. 13 to 16 possible?

-> $ sudo -u postgres pg_upgrade -D /var/lib/pgsql/data/

You must identify the directory where the old cluster binaries reside.
Please use the -b command-line option or the PGBINOLD environment variable.
Failure, exiting

Or is a restoration from a backup the only way?

many thanks, L.

Re: upgrade from 13 to 16

От
Ilya Kosmodemiansky
Дата:
Hi listy,

On Mon, Mar 2, 2026 at 1:43 PM listy <listy@localities.work> wrote:

Is upgrade from ver. 13 to 16 possible?
 it is. You need to use the latest pg_upgrade binary (from version 16 in this case) 
 

-> $ sudo -u postgres pg_upgrade -D /var/lib/pgsql/data/
 
You must identify the directory where the old cluster binaries reside.

It tells you exactly what to do. pg_upgrade requires both the old and new clusters, data dirs and binaries.  So you need to specify aloof -b, -B, -d and -D
 
Please use the -b command-line option or the PGBINOLD environment variable.
Failure, exiting

Or is a restoration from a backup the only way?

many thanks, L.


--
Ilya Kosmodemiansky
CEO, Founder

Data Egret GmbH
Your remote PostgreSQL DBA team
T.: +49 6821 919 3297
ik@dataegret.com


Re: upgrade from 13 to 16

От
listy
Дата:
So, for now & the future "issues"...
Since on LInux - unless tampered with manually - binaries get replaced upon upgrades of a package:
Is it worthwhile tampering with binaries as opposed to starting anew and with a backup? (which I eventually did, I get it might be a personal preference)

many thanks, L.

Re: upgrade from 13 to 16

От
Ron Johnson
Дата:
On Mon, Mar 2, 2026 at 8:48 AM listy <listy@localities.work> wrote:
So, for now & the future "issues"...
Since on LInux - unless tampered with manually - binaries get replaced upon upgrades of a package:

Please clarify.  Because the application directories created by RPMs and debs in the PGDG repository (which I recommend that you use instead of the ones from your distro) are multi-version:

$ ls -1 /usr | grep pgsql
pgsql-13
pgsql-14
pgsql-15
pgsql-16
pgsql-17
pgsql-9.6

--
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!

Re: upgrade from 13 to 16

От
listy
Дата:
Cannot say about Debian but RHEL family (perhaps exceptions exist) do not, certainly not on Centos, Ubuntu which I use, yes.
But also rhel/centos do not do major PGsql rel. upgrade within the same/one OS release, I do not think so.
What happened to me - what I did rather - was upgrade from c9 to c10. (not officially supported.)

Re: upgrade from 13 to 16

От
Ron Johnson
Дата:
On Mon, Mar 2, 2026 at 9:09 AM listy <listy@localities.work> wrote:
Cannot say about Debian but RHEL family (perhaps exceptions exist) do not, certainly not on Centos, Ubuntu which I use, yes.
But also rhel/centos do not do major PGsql rel. upgrade within the same/one OS release, I do not think so.
What happened to me - what I did rather - was upgrade from c9 to c10. (not officially supported.)

This is why I strongly urge you to use the PGDG repositories, not the packages which RHEL builds.

--
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!

Re: upgrade from 13 to 16

От
Laurenz Albe
Дата:
On Mon, 2026-03-02 at 13:43 +0100, listy wrote:
> Is upgrade from ver. 13 to 16 possible?

Yes.

> -> $ sudo -u postgres pg_upgrade -D /var/lib/pgsql/data/
> You must identify the directory where the old cluster binaries reside.Please use the -b command-line option or the
PGBINOLDenvironment variable. 
> Failure, exiting
>
> Or is a restoration from a backup the only way?
>
> If you cannot be bothered to read the documentation for pg_upgrade, then
dump and restore may be the only way.

Yours,
Laurenz Albe



Re: upgrade from 13 to 16

От
Holger Jakobs
Дата:
Am 02.03.26 um 15:31 schrieb Ron Johnson:
On Mon, Mar 2, 2026 at 9:09 AM listy <listy@localities.work> wrote:
Cannot say about Debian but RHEL family (perhaps exceptions exist) do not, certainly not on Centos, Ubuntu which I use, yes.
But also rhel/centos do not do major PGsql rel. upgrade within the same/one OS release, I do not think so.
What happened to me - what I did rather - was upgrade from c9 to c10. (not officially supported.)

This is why I strongly urge you to use the PGDG repositories, not the packages which RHEL builds.

--
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!

Yes, RHEL doesn't take into account that PostgreSQL will ever be upgraded to another major version. They support the version which was current when they had their feature freeze for the lifetime of the system.

Therefore Ron is perfectly correct in writing that everybody should use the PGDG from the beginning.

You might have success installing the new version from PGDG repos and then run pg_upgrade (with all 4 mentioned options) from the new version. The preconditions for pg_upgrade are:

  • you have the old and the new software version installed (pg-13 and pg-18) in different directories
  • you have the old cluster unchanged and an empty new cluster in different directories

Maybe it helps to move the data directory of the old cluster before installing the new software package. Make sure you also change the path in the systemd service unit of the old version.

If the database isn't large, dump & restore will also work fine.

Regards,

Holger

--

Holger Jakobs, Bergisch Gladbach, Germany