Skip to content

feat: let a postgres preset declare the extensions its image can create - #10

Merged
geodro merged 1 commit into
mainfrom
feat/declare-extensions
Jul 24, 2026
Merged

feat: let a postgres preset declare the extensions its image can create#10
geodro merged 1 commit into
mainfrom
feat/declare-extensions

Conversation

@geodro

@geodro geodro commented Jul 24, 2026

Copy link
Copy Markdown
Member

An engine's image ships extensions that its databases mostly do not have. postgres-timescaledb worked around that with a site_init exec, which runs once per project when lerd env detects the service and names only the app database, so the testing one never got it and a snapshot restore, which drops and recreates, took it away again. postgres-pgvector had nothing at all, so vector was only ever created by hand, on an image installed for that one reason.

The declaration replaces the workaround with something lerd can read rather than just execute. An entry marked always is created wherever lerd creates a database, so both databases of a project get it and a recreated one comes back whole. The types are what an import matches a dump against, so a dump reaching for a vector column brings the extension with it instead of failing on a type that does not exist, which is the usual shape of a dump from a managed provider, where pg_dump leaves out the extensions the connecting user does not own.

postgres-timescaledb keeps its site_init line for now. Presets reach installed users within a day and binaries do not, so removing it before the release that understands extensions would leave timescale sites with neither.

Needs lerd-env/lerd#1139, which adds the field. Until that ships the entries are inert, so this can land in either order.

An engine's image ships extensions that its databases mostly do not have. timescaledb worked around that with a site_init exec, which runs once per project when lerd env detects the service and names only the app database, so the testing one never got it and a snapshot restore, which drops and recreates, took it away again. pgvector had nothing at all, so vector was only ever created by hand, on an image installed for that one reason.

The declaration replaces the workaround with something lerd can read rather than just execute. An entry marked always is created wherever lerd creates a database, so both databases of a project get it and a recreated one comes back whole. The types are what an import matches a dump against, so a dump reaching for a vector column brings the extension with it instead of failing on a type that does not exist, which is the usual shape of a dump from a managed provider, where pg_dump leaves out the extensions the connecting user does not own.

timescaledb keeps its site_init line for now. Presets reach installed users within a day and binaries do not, so removing it before the release that understands extensions would leave timescale sites with neither.
@geodro
geodro requested a review from a team as a code owner July 24, 2026 12:12
@geodro
geodro merged commit ada7a5a into main Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant