Postgresql upgrade from 13 to 15 with Timescaledb

I was running a databases/postgresql13-server server in a jail with databases/timescaledb installed and enabled for some databases. Through a pkg update process, the databases/timescaledb was updated to version 2.13.1 (I don't recall which version was installed) which installed also as a dependency the databases/postgresql15-server.

I am trying to upgrade the postgresql server from version 13 to version 15,

I fetched the databases/postgresql13-server and databases/timescaledb pkgs and put them under /root/postgresql/13/

Now I am trying to upgrade by issuing the command:
su -l postgres -c "pg_upgrade -b /root/postgresql/13/usr/local/bin/ -d /var/db/postgres/data13/ -B /usr/local/bin/ -D /var/db/postgres/data15/ -U postgres "
but I get the error:
Code:
Performing Consistency Checks
-----------------------------
Checking cluster versions                                   ok

*failure*
Consult the last few lines of "/var/db/postgres/data15/pg_upgrade_output.d/20240202T130233.819/log/pg_upgrade_server.log" for
the probable cause of the failure.

connection to server on socket "/var/db/postgres/.s.PGSQL.50432" failed: No such file or directory
        Is the server running locally and accepting connections on that socket?

could not connect to source postmaster started with the command:
"/root/postgresql/13/usr/local/bin/pg_ctl" -w -l "/var/db/postgres/data15/pg_upgrade_output.d/20240202T130233.819/log/pg_upgrade_server.log" -D "/var/db/postgres/data13" -o "-p 50432 -b  -c listen_addresses='' -c unix_socket_permissions=0700 -c unix_socket_directories='/var/db/postgres'" start
Failure, exiting
From the suggested error log file:
Code:
-----------------------------------------------------------------
  pg_upgrade run on Fri Feb  2 13:02:33 2024
-----------------------------------------------------------------

command: "/root/postgresql/13/usr/local/bin/pg_ctl" -w -l "/var/db/postgres/data15/pg_upgrade_output.d/20240202T130233.819/log/pg_upgrade_server.log" -D "/var/db/postgres/data13" -o "-p 50432 -b  -c listen_addresses='' -c unix_socket_permissions=0700 -c unix_socket_directories='/var/db/postgres'" start >> "/var/db/postgres/data15/pg_upgrade_output.d/20240202T130233.819/log/pg_upgrade_server.log" 2>&1
waiting for server to start....2024-02-02 11:02:33.955 GMT [30710] FATAL:  could not load library "/root/postgresql/13/usr/local/lib/postgresql/timescaledb.so": /root/postgresql/13/usr/local/lib/postgresql/timescaledb.so: Undefined symbol "shmem_request_hook"
2024-02-02 11:02:33.955 GMT [30710] LOG:  database system is shut down
 stopped waiting
pg_ctl: could not start server
Examine the log output.

The /root/postgresql/13/usr/local/lib/postgresql/timescaledb.so is there but I assume this version (2.13.1) is incompatible with the postgresql13-server.

Is this the right way to upgrade the postgresql server? Should I fetch an older version of timescaledb, compatible with the postgresql13-server (how do I fetch older versions of packages)?

Any help, would be appreciated.
 
Here's my notes during similar update from last year:
They are mix between 10->11,13->15 but idea of the exact postgresql13-server,contrib is the same.
----
Both postgre13 and postgre15 must be build with the same version of ICU!

service postgresql stop
pkg create postgresql13-server postgresql13-client
rm -dR /tmp/pg-upgrade
mkdir /tmp/pg-upgrade
tar xf postgresql10-server-13.12.txz -C /tmp/pg-upgrade/
tar xf postgresql10-contrib-13.12.txz -C /tmp/pg-upgrade
tar xf /var/cache/pkg/icu-73.2,1.pkg -C /tmp/pg-upgrade

pkg delete postgresql13-client

su -l postgres -c "/usr/local/bin/initdb --encoding=utf-8 --lc-collate=C -D /var/db/postgres/data11 "
su -l postgres -c "pg_upgrade -b /tmp/pg-upgrade/usr/local/bin/ -d /var/db/postgres/data10/ -B /usr/local/bin/ -D /var/db/postgres/data11/ "
su -l postgres -c "/var/db/postgres/analyze_new_cluster.sh"
#### WARNING ### this will delete the old data10 folder.
su -l postgres -c "/var/db/postgres/delete_old_cluster.sh"

/usr/local/etc/rc.d/postgresql initdb

su -l postgres -c "pg_upgrade -b /tmp/pg-upgrade/usr/local/bin/ -d /var/db/postgres/data13/ -B /usr/local/bin/ -D /var/db/postgres/data15/"


su -l postgres -c "pg_upgrade -b /tmp/pg-upgrade/usr/local/bin/ -d /var/db/postgres/data13/ -B /usr/local/bin/ -D /var/db/postgres/data15/ "
su -l postgres -c "/var/db/postgres/analyze_new_cluster.sh"
#### WARNING ### this will delete the old data13 folder.
su -l postgres -c "/var/db/postgres/delete_old_cluster.sh"

pg_hba.conf


www.postgresql.org/docs/current/upgrading.html

For old version you can check
/var/cache/pkg You may need to rebuild via ports v13 and v15 so the ICU version match otherwise you will get error of pg_upgrade with incompatible ICU.
 
Here's my notes during similar update from last year:
They are mix between 10->11,13->15 but idea of the exact postgresql13-server,contrib is the same.
----


For old version you can check
/var/cache/pkg You may need to rebuild via ports v13 and v15 so the ICU version match otherwise you will get error of pg_upgrade with incompatible ICU.
Thanks for your reply, but I believe this will not solve my problem, which I assume has to do with the timescaledb dependency.
 
Yes you need the old timescaledb.so version. Your best option is to rebuild the old version postgresql13-server with timescaledb from ports then to create a package of it. Then uninstall v13 and install v15.
 
Back
Top