ALTER EXTENSION

A DDL command for modifying an extension

ALTER EXTENSION is a DDL command for modifying an extension, including performing version upgrades.

ALTER EXTENSION was added in PostgreSQL 9.1.

Change history

Examples

Upgrading an extension using ALTER EXTENSION ... UPDATE:

repmgr=# \dx repmgr
                  List of installed extensions
  Name  | Version | Schema |            Description             
--------+---------+--------+------------------------------------
 repmgr | 5.1     | repmgr | Replication manager for PostgreSQL
(1 row)

repmgr=# SELECT name, version, installed
             FROM pg_available_extension_versions
            WHERE name='repmgr'
         ORDER BY version DESC
            LIMIT 1;
  name  | version | installed
--------+---------+-----------
 repmgr | 5.2     | f
(1 row)

repmgr=# ALTER EXTENSION repmgr UPDATE;
ALTER EXTENSION

repmgr=# \dx repmgr
                  List of installed extensions
  Name  | Version | Schema |            Description             
--------+---------+--------+------------------------------------
 repmgr | 5.2     | repmgr | Replication manager for PostgreSQL
(1 row)

Categories

DDL, Extension, SQL command

See also

CREATE EXTENSION, DROP EXTENSION, extension