Skip to content

PostgreSQL extensions ​

Extensions are packages that add capabilities to a PostgreSQL server — extra data types and operators, cryptographic functions, query statistics and more. On Frostmoln managed databases extensions are a PostgreSQL offer, served from the platform's own extension catalog. MySQL instances have none.

How it works ​

  • An extension applies to every database on the instance. Enabling runs CREATE EXTENSION in every database that accepts connections — your own databases, postgres, and template1 — and disabling runs DROP EXTENSION in each of them. Because template1 gets it too, a database you create later with a plain CREATE DATABASE already has every enabled extension. A database created from template0 (as in Locales and collation) or while an operation is running does not: run the enable again, which is accepted for an extension that is already enabled and adds it where it is missing.
  • Names are catalog values, not free strings. Only names the platform's extension catalog advertises can be enabled on an instance. An unknown name gets a typed HTTP 400 that names it — unknown extension: <name> — and a name the catalog holds but does not offer for the instance's PostgreSQL version is refused too. Any authenticated tenant can read the catalog at GET /api/v1/databases/extensions (like the types/versions/flavors reads). The Extensions tab in the portal offers a catalog picker, and the Terraform provider checks names against the live catalog at plan time.
  • One operation at a time per instance. While an operation runs, another extension operation is refused with HTTP 409: another operation is already running on this instance; extensions can be applied only while no backup, restore or other operation is in flight — please retry once it completes. Extensions are also refused while a backup or restore is in flight.
  • The platform records outcomes once, at the end. While an apply runs, GET /api/v1/tenants/:tenant_id/databases/:id/extensions keeps showing the asked-for revision (extensionRevision) with no new entries. Per-extension entries — name, status enabled, removed or failed, plus optional detail and updatedAt — appear only when the operation concludes, and a failed apply is recorded with the platform's reason. There is no in-flight per-extension progress.

The catalog ​

The seed set the v1 catalog shipped with:

ExtensionPostgreSQL versionsRequires restart
timescaledb16, 17, 18Yes
pg_stat_statements14, 15, 16, 17, 18Yes
pg_trgm14–18No
pgcrypto14–18No
unaccent14–18No

timescaledb and pg_stat_statements need shared_preload_libraries, which takes effect at startup — so enabling either restarts the instance. The catalog grows as validated platform-catalog values are added.

pg_trgm, unaccent and pgcrypto are trusted extensions: any role with the CREATE privilege on the database (such as pgadmin) can also create them directly in SQL, one database at a time:

sql
CREATE EXTENSION IF NOT EXISTS unaccent;

The platform does not record an extension created this way, so it cannot disable it either — the request is refused as not present on the instance. Remove it with DROP EXTENSION yourself.

Availability and access ​

  • Open to every tenant. The recorded extension state is visible to anyone who can see the instance, and every tenant can enable or disable extensions on its own instances.
  • Highly available instances are excluded for now. The request is refused with HTTP 409: extensions are not yet available for highly available instances; coordinated node sequencing is not built yet
  • Instances created before extensions shipped cannot enable them. The in-guest pieces the apply needs are fixed at create time, and the platform does not refuse the request up front: an enable on such an instance is accepted and then recorded as failed entries on its ledger. The treatment is rebuild-to-enable — create a new instance and migrate your data (the Managed Databases page covers provisioning and migration).

Disabling an extension ​

Disabling runs DROP EXTENSION without CASCADE in every database, so it removes the extension's own objects — including the rows in any configuration tables the extension keeps — but never your objects that depend on it:

  • A dependent object makes the operation fail. An index using gin_trgm_ops, a column of an extension type or a TimescaleDB hypertable blocks the drop in that database. The extension is still dropped from every other database, and its entry shows failed with a detail that says how many databases are affected: extension remove "pg_trgm" had 1 unexpected error(s) in 1 of 3 database(s). Database names are never included. Drop the dependent objects and disable again.
  • It also drops copies you created yourself. If a name is enabled through the platform, disabling it removes it from every database — including one where you ran CREATE EXTENSION in SQL yourself.

Using it ​

The endpoint is POST /api/v1/tenants/:tenant_id/databases/:id/extensions. The body carries the direction — "op" is "install" to enable, "remove" to disable — and the list of extension names, up to 8 per operation:

json
{
  "op": "install",
  "extensions": ["timescaledb"]
}

A 202 comes back with an operationId, the status applying_extensions and the extensionRevision this ask staged. Until the operation concludes, the ledger keeps showing exactly that revision with no new entries for it; when it concludes, the entries appear (see above). Two checks the platform makes on the spot: the instance must be running — any other state is refused with 409 — and disabling an extension the instance does not have is refused with 400.

The fm CLI speaks enable and disable and does the waiting for you: fm database postgres instance extensions enable|disable waits for the operation to conclude and verifies the recorded outcome against it (pass --no-wait to return as soon as the request is accepted), and ... extensions list shows the recorded ledger whenever you ask.

In Terraform, declare the extensions set on the frostmoln_postgres_instance resource — the generated reference documents the attribute.

Limits in one place

  • Extensions exist on PostgreSQL only — MySQL instances have none.
  • Operations are accepted only while the instance is running.
  • One operation at a time per instance.
  • Up to 8 names per operation.
  • Enable and disable act on every database of the instance.