postgresql,

How to upgrade and downgrade extensions in PostgreSQL

Feb 19, 2022 · 1 min read · Post a comment

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 going to 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.