Search code examples
timescaledb

TimescaleDB upgrade within a docker container, new DBs are created with old TimescaleDB version


I decided to upgrade TimescaleDB from version 2.9.3 to version 2.14.2.
I followed the upgrade documentation here: https://docs.timescale.com/self-hosted/latest/upgrades/upgrade-docker/

Everything was OK. My databases upgraded TimescaleDB to a newer version successfully. But when I create a new database it's created with the old 2.9.3 TimescaleDB version and I need to execute ALTER EXTENSION timescaledb UPDATE; every time I create a new database. Is there a way to fix this? Why doesn't it use 2.14.2 version?


Solution

  • The fact that a newly-created database has the timescaledb extension installed is because the timescaledb extension is installed into the special template1 database. If you want new databases to be created with the newest version of timescaledb, you need to upgrade the version of timescaledb installed in the template1 database.

    In a psql session you can connect to the template1 database and update timescaledb with the following commands:

    \c template1
    ALTER EXTENSION timescaledb UPDATE;