How extensions are installed
Understand who installs PostgreSQL extensions in a project, check what yours has, and know what to do when an extension you need is missing.
Mental model#
Installing a PostgreSQL extension needs more privileges than any role of a project has: even a trusted extension requires the right to create objects in the database. So the platform installs extensions itself, with the identity of the cluster operator, when it creates the database of a project. Your roles then use them like any other type or function.
project creation ──▶ cluster operator ──▶ CREATE EXTENSION × 13 (in schema public)
GraphQL enabled ──▶ provisioning job ──▶ CREATE EXTENSION pg_graphql
your SQL ──▶ aura db raw ──▶ CREATE EXTENSION refused (400)
your SQL ──▶ direct connection ──▶ refused by PostgreSQLInstalled at creation#
On the cluster of an organization (Free and Pro), the database of every new project is created with these 13 extensions, in the public schema:
| Extension | Use |
|---|---|
vector (pgvector) | Vector columns and similarity search |
pgcrypto | Hashing, encryption, gen_random_bytes() |
uuid-ossp | UUID generators such as uuid_generate_v4() |
pg_trgm | Trigram similarity and fast LIKE / ILIKE |
citext | Case-insensitive text |
hstore | Key-value pairs in one column |
ltree | Hierarchical labels (paths in a tree) |
unaccent | Text without accents, for search |
btree_gin, btree_gist | B-tree operator classes for GIN and GiST indexes |
fuzzystrmatch | Soundex, Levenshtein and other fuzzy matching |
intarray | Functions and operators on integer arrays |
pg_stat_statements | Query statistics, read by aura db slow-queries; preloaded by the cluster |
pg_graphql is not installed at creation: it is added when you enable GraphQL on the project (aura projects graphql-enable). On a dedicated cluster (Team and Enterprise), the provisioning code installs at least vector, pgcrypto, uuid-ossp and pg_trgm; that path was not replayed for this page.
The allowed list#
The database service accepts 14 names: the 13 above and pg_graphql. Any other extension is refused before PostgreSQL sees the request. postgis, pg_cron, timescaledb, pgmq and pg_partman are not in the list; for scheduled work, run an Edge Function on a schedule with Cron.
Check your project#
aura db extensions list» Installed extensions
Name Version Schema
btree_gin 1.3 public
btree_gist 1.8 public
citext 1.8 public
fuzzystrmatch 1.2 public
hstore 1.8 public
intarray 1.5 public
ltree 1.3 public
pg_stat_statements 1.12 public
pg_trgm 1.6 public
pgcrypto 1.4 public
plpgsql 1.0 pg_catalog
unaccent 1.1 public
uuid-ossp 1.1 public
vector 0.8.7 public
ℹ 14 extension(s). Enable another allowed one with aura db extensions enable <name>plpgsql is the procedural language that PostgreSQL installs in every database. The Studio shows the same list under Database › Extensions, and GET /v1/db/{project_id}/schema/extensions returns it as JSON.
An extension outside the allowed list is refused by the API:
curl -s -X POST "$AURABASE_URL/v1/db/$PROJECT_ID/schema/extensions" \
-H "apikey: $AURABASE_SERVICE_ROLE_KEY" \
-H 'content-type: application/json' \
-d '{"name": "postgis"}'{"error":{"code":"BAD_REQUEST","message":"Invalid request: Extension 'postgis' is not allowed on this cluster. Allowed extensions: pgcrypto, uuid-ossp, pg_trgm, citext, hstore, ltree, unaccent, vector, pg_graphql, btree_gin, btree_gist, fuzzystrmatch, intarray, pg_stat_statements","request_id":"a215bf77-8d51-48d6-b8a7-81f600b7b23d","type":"request_invalid"}}What enable does#
aura db extensions enable <name> (and POST /v1/db/{project_id}/schema/extensions) checks the name against the allowed list, then runs CREATE EXTENSION IF NOT EXISTS "<name>" CASCADE with the administrator role of the project. For an extension already installed at creation, that is a no-op that answers with its version:
aura db extensions enable citext ✔ Extension citext enabled (version 1.8).For an allowed extension that is not installed yet, the statement needs a privilege the project role does not have, and fails. This is the case of pg_graphql: aura db extensions enable pg_graphql answers Cannot enable extension 'pg_graphql' from the project role: Invalid request: permission denied for database …. Install it with aura projects graphql-enable instead, which runs as the cluster operator.
CREATE EXTENSION sent as SQL never reaches PostgreSQL through aura db raw: the endpoint refuses it with 400 and points to aura db extensions enable. Over the direct connection, PostgreSQL refuses it: permission denied for database … for an extension of the image (pg_graphql), extension "postgis" is not available for one the image does not contain.
Trade-offs#
- A fixed list. You cannot add an extension of your own, nor one that is not in the list, on a managed project. The list is the same for every project of a deployment.
- No version choice. Each extension comes in the version of the PostgreSQL image of the cluster (for example
vector0.8.7 above).ALTER EXTENSION … UPDATEis refused:must be owner of extension citext. - Older projects. A project created before the list grew to 13 has only the extensions installed at that time, and
enablecannot add the others from the project role. The error message ofenablesuggests contacting support or recreating the project; there is no command to backfill them. - Extensions live in
public. Their functions and types are found through the search path; you do not need to qualify them.
Related pages#
- GraphQL
Enable pg_graphql on a project and query it.
- Run SQL from the CLI or a server
The SQL check that refuses CREATE EXTENSION, and what else it refuses.
- Shared and dedicated clusters
Why the two placements start with different extensions.
- Performance audit
Use pg_stat_statements through aura db slow-queries.