Use PostgreSQL extensions in your Azure Arc-enabled PostgreSQL server
PostgreSQL is at its best when you use it with extensions.
[!INCLUDE [azure-arc-data-preview](./includes/azure-arc-data-preview.md]
Supported extensions
The following extensions are deployed by default in the containers of your Azure Arc-enabled PostgreSQL server, some of them are standard contrib
extensions:
address_standardizer_data_us
3.3.1adminpack
2.1amcheck
1.3autoinc
1bloom
1btree_gin
1.3btree_gist
1.6citext
1.6cube
1.5dblink
1.2dict_int
1dict_xsyn
1earthdistance
1.1file_fdw
1fuzzystrmatch
1.1hstore
1.8hypopg
1.3.1insert_username
1intagg
1.1intarray
1.5isn
1.2lo
1.1ltree
1.2moddatetime
1old_snapshot
1orafce
4pageinspect
1.9pg_buffercache
1.3pg_cron
1.4-1pg_freespacemap
1.2pg_partman
4.7.1pg_prewarm
1.2pg_repack
1.4.8pg_stat_statements
1.9pg_surgery
1pg_trgm
1.6pg_visibility
1.2pgaudit
1.7pgcrypto
1.3pglogical
2.4.2pglogical_origin
1.0.0pgrouting
3.4.1pgrowlocks
1.2pgstattuple
1.5plpgsql
1postgis
3.3.1postgis_raster
3.3.1postgis_tiger_geocoder
3.3.1postgis_topology
3.3.1postgres_fdw
1.1refint
1seg
1.4sslinfo
1.2tablefunc
1tcn
1timescaledb
2.8.1tsm_system_rows
1tsm_system_time
1unaccent
1.1
Updates to this list will be posted as it evolves over time.
Enable extensions in Arc-enabled PostgreSQL server
You can create an Arc-enabled PostgreSQL server with any of the supported extensions enabled by passing a comma separated list of extensions to the --extensions
parameter of the create
command.
az postgres server-arc create -n <name> --k8s-namespace <namespace> --extensions "pgaudit,pg_partman" --use-k8s
NOTE: Enabled extensions are added to the configuration shared_preload_libraries
. Extensions must be installed in your database before you can use it. To install a particular extension, you should run the CREATE EXTENSION
command. This command loads the packaged objects into your database.
For example, connect to your database and issue the following PostgreSQL command to install pgaudit extension:
CREATE EXTENSION pgaudit;
Update extensions
You can add or remove extensions from an existing Arc-enabled PostgreSQL server.
You can run the kubectl describe command to get the current list of enabled extensions:
kubectl describe postgresqls <server-name> -n <namespace>
If there are extensions enabled the output contains a section like this:
config:
postgreSqlExtensions: pgaudit,pg_partman
Check whether the extension is installed after connecting to the database by running following PostgreSQL command:
select * from pg_extension;
Enable new extensions by appending them to the existing list, or remove extensions by removing them from the existing list. Pass the desired list to the update command. For example, to add pgcrypto
and remove pg_partman
from the server in the example above:
az postgres server-arc update -n <name> --k8s-namespace <namespace> --extensions "pgaudit,pgrypto" --use-k8s
Once allowed extensions list is updated. Connect to the database and install newly added extension by the following command:
CREATE EXTENSION pgcrypto;
Similarly, to remove an extension from an existing database issue the command DROP EXTENSION
:
DROP EXTENSION pg_partman;
Show the list of installed extensions
Connect to your database with the client tool of your choice and run the standard PostgreSQL query:
select * from pg_extension;
Related content
- Try it out. Get started quickly with Azure Arc Jumpstart on Azure Kubernetes Service (AKS), AWS Elastic Kubernetes Service (EKS), Google Cloud Kubernetes Engine (GKE) or in an Azure VM.