You should be using \dx
, as it shows the actually loaded extension version, check the "main" database postgres
first:
$ psql
\dx timescaledb
\c some_database
\dx timescaledb
the output looks like this:
List of installed extensions
Name | Version | Schema | Description
-------------+---------+--------+-------------------------------------------------------------------
timescaledb | 2.9.3 | public | Enables scalable inserts and complex queries for time-series data
or
psql -d database_name -c "\dx timescaledb"
pg_available_extensions
will show available extension, however some database could be been created with much older extension version.
psql -c "SELECT default_version, installed_version FROM pg_available_extensions where name = 'timescaledb';"
default_version | installed_version
-----------------+-------------------
2.13.0 | 2.10.1
Before extension upgrade you should check the supported paths and release notes, for your version, e.g.:
SELECT * FROM pg_extension_update_paths('timescaledb') WHERE source='2.9.3';
this corresponds to sql
scripts on disk, where you can find all upgrade steps:
l /usr/share/postgresql/14/extension/timescaledb--2.9*
Extension upgrade can be done automatically (to the latest version):
psql -X -c "ALTER EXTENSION timescaledb UPDATE;"
or to a specific version, assuming the upgrade path exists:
psql -X -c "ALTER EXTENSION timescaledb UPDATE TO '2.13.0';"
SELECT extversion FROM pg_extension
gives you the installed extensions for the current connected database. Try this. 1. Connect to db1; 2. Create extensioncreate extension postgres_fdw
; 3. execute your query, you'll see postgres_fdw with it's version; 4. create new db2; 5. connect to db2 and execute the query, you will not see postgres_fdw in the list of extensions – Primogenitor