postgresql,

How to Upgrade and Downgrade Extensions in PostgreSQL

Feb 19, 2022 · 1 min read · Post a comment
How to Upgrade and Downgrade Extensions in PostgreSQL

Extensions in PostgreSQL are basically packages with additional features. The popular ones include TimescaleDB, PostGIS, pg_stat_statements, ZomboDB and Postgres_fdw. Today’s focus gonna be on extension upgrade, downgrade and listing versions.

Prerequisites

  • PostgreSQL

Upgrade extensions

Upgrade to the latest version:

ALTER EXTENSION <extension_name> UPDATE;

Upgrade to a specific version:

ALTER EXTENSION <extension_name> UPDATE TO '1.4.2';

Downgrade extensions

Downgrade extension to a specific version:

CREATE EXTENSION <extension_name> WITH VERSION '1.3.0';

List extension versions

List of installed extensions:

\dx

List available extension versions:

SELECT name, version, installed
FROM   pg_available_extension_versions
WHERE  name = '<extension_name>';

Conclusion

Check out the latest posts from the PostgreSQL category.
On a side note, follow our official channel on Telegram.