Manage Extensions
List the PostgreSQL extensions your Managed PostgreSQL service offers, create them in the databases that need them, update them and remove them.
Before You Start
Open a psql session as avnadmin, connected to the database where you want the extension. See
Connect with psql.
Extensions are managed with SQL only: there is no API endpoint or exo command for them.
List What Is Available
Extensions the server offers, with the version CREATE EXTENSION installs:
SELECT name, default_version, installed_version, comment
FROM pg_available_extensions
ORDER BY name;Versions an extension can be created at or updated to:
SELECT name, version, superuser, trusted, requires
FROM pg_available_extension_versions
WHERE name = 'vector'
ORDER BY version;On PostgreSQL 18, avnadmin can create every extension in pg_available_extensions except
file_fdw. On older major versions, more are refused. The lists per version are in
Supported extensions
and Extension versions.
To know whether an extension works on your service, create it, see
What You Cannot Install.
Create an Extension
A new database only has plpgsql. Create other extensions explicitly:
CREATE EXTENSION pg_stat_statements;Extensions belong to a database. CREATE EXTENSION in defaultdb does nothing for another
database: run it in every database that needs the extension, including databases created later.
When an extension depends on others, add CASCADE to create them too. Without it, the statement
fails with required extension "..." is not installed:
CREATE EXTENSION vectorscale CASCADE;Use the SQL name, which differs from the project name for a few extensions:
| Project | Name in CREATE EXTENSION |
|---|---|
| pgvector | vector |
| pgvectorscale | vectorscale |
| PostgreSQL Anonymizer | anon |
| PostGIS TIGER geocoder | postgis_tiger_geocoder |
Extensions with a Specific Schema
Most extensions install into public. Some use their own schema: aiven_extras installs into
aiven_extras, pg_cron is registered in pg_catalog with its objects in cron,
postgis_topology uses topology, postgis_tiger_geocoder uses tiger.
pg_partman installs into the current schema unless you name one, and cannot be moved later
(extension "pg_partman" does not support SET SCHEMA). Create its schema first:
CREATE SCHEMA partman;
CREATE EXTENSION pg_partman SCHEMA partman;See Use pg_partman.
Ownership
Extensions that a database owner may create (trusted extensions, such as pgcrypto or anon)
are owned by avnadmin. The others are created on your behalf by the platform and owned by
postgres. avnadmin can still update and drop both kinds.
Check What Is Installed
SELECT e.extname, e.extversion, n.nspname AS schema
FROM pg_extension e
JOIN pg_namespace n ON n.oid = e.extnamespace
ORDER BY 1;The psql meta-command \dx shows the same list with descriptions.
Update an Extension
An installed extension keeps its version until you update it. Compare installed_version with
default_version in pg_available_extensions, then:
ALTER EXTENSION pg_stat_statements UPDATE;Without a target, the extension moves to default_version. To move to a given version:
ALTER EXTENSION pg_stat_statements UPDATE TO '1.11';When no update path leads to the version you name, the statement fails with
has no update path from version "..." to version "...".
Tip
To try an update on a copy first, create a new service from a point in time, run the update there and test your application against it. See Fork a service.
Remove an Extension
DROP EXTENSION pg_stat_statements;When objects depend on the extension, the statement fails and lists them, for example the
columns of type geometry for postgis:
ERROR: cannot drop extension postgis because other objects depend on it
DETAIL: column geom of table regions depends on type geometryDROP EXTENSION ... CASCADE drops those objects as well, data included. Read the list first.
What You Cannot Install
On PostgreSQL 18:
file_fdw: refused withERROR: file_fdw extension not allowed.pg_cron: only indefaultdb. Elsewhere,ERROR: can only create extension in database defaultdb. See Use pg_cron.amcheck,pageinspect,pg_logicalinspect,pg_surgery,pg_walinspect: they install, but their functions fail withpermission denied for function ...asavnadmin.pg_stat_monitor,pg_stat_plans: they install, but their modules are not loaded, so their views fail. Usepg_stat_statements.- Untrusted languages such as
plpython3uandplperlu, andpostgis_legacy: not offered,CREATE EXTENSIONfails withextension "..." is not available.
On PostgreSQL 17 and older, several more extensions are refused with
permission denied to create extension, for example amcheck, pageinspect,
pg_freespacemap and pg_visibility. Check the extensions you need before choosing an older
version.
You cannot load your own extension binaries onto the service.