Skip to content

Install extensions in the service's own schema - #386

Merged
mahlunar merged 2 commits into
masterfrom
fix/install-extensions-in-service-schema
Aug 6, 2026
Merged

Install extensions in the service's own schema#386
mahlunar merged 2 commits into
masterfrom
fix/install-extensions-in-service-schema

Conversation

@mahlunar

@mahlunar mahlunar commented Aug 4, 2026

Copy link
Copy Markdown
Member

Problem

installExtensions created extensions with WITH SCHEMA <serviceCredentials.Name>, i.e. the database name. For shared databases the database name is the name of another service's schema, so extensions could be installed into a schema belonging to a different service. In almost all cases, this changes nothing as normally only one service uses a single database.

Change

Use serviceCredentials.User instead — the schema named after the service user, which the service actually owns.

Notes

  • For non-shared databases name and user typically match, so behaviour is unchanged there.
  • Existing extensions already created in the wrong schema are not moved by this change.

Note

Medium Risk
Changes where new extensions are created on shared databases; existing mis-placed extensions are not migrated, so behaviour only affects new installs.

Overview
installExtensions now runs CREATE EXTENSION ... WITH SCHEMA using serviceCredentials.User instead of serviceCredentials.Name, so extensions land in the schema owned by the service user.

On shared databases, the database name can match another service’s schema, which previously caused extensions to be created in the wrong schema. Dedicated databases where name and user match are unchanged.

This does not relocate extensions already created in the wrong schema.

Reviewed by Cursor Bugbot for commit 85ee40a. Configure here.

Extensions were installed with `WITH SCHEMA <database name>`. For shared
databases the database name is the name of another service's schema, so
extensions ended up in the wrong schema.

Use the service user name instead, which is the schema owned by the
service itself.
@mahlunar
mahlunar marked this pull request as ready for review August 4, 2026 08:35
@mahlunar
mahlunar requested a review from a team as a code owner August 4, 2026 08:35
@mahlunar
mahlunar merged commit df73c1a into master Aug 6, 2026
5 checks passed
@mahlunar
mahlunar deleted the fix/install-extensions-in-service-schema branch August 6, 2026 05:44
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.

2 participants