feat: turn pg_graphql off by default for new projects#2119
Open
feat: turn pg_graphql off by default for new projects#2119
Conversation
PostgreSQL Extension Dependency Analysis: PR #2119
SummaryNo extensions had dependencies with MAJOR version updates. Full Analysis ResultsPostgreSQL 15 Extension DependenciesPostgreSQL 17 Extension DependenciesOrioleDB 17 Extension Dependencies |
PostgreSQL Package Dependency Analysis: PR #2119
SummaryNo packages had MAJOR version updates. Full Analysis ResultsPostgreSQL 15 Dependency ChangesExtracting PostgreSQL 15 dependencies...
Runtime Closure Size
Raw Dependency ClosurePostgreSQL 17 Dependency ChangesExtracting PostgreSQL 17 dependencies...
Runtime Closure Size
Raw Dependency Closure |
pashkinelfe
approved these changes
Apr 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ships pg_graphql disabled by default on newly-provisioned Postgres instances. Existing projects are unaffected because the new migrations only run on first boot (sentinel-guarded).
Changes
New migrations
20260421000000_pg_graphql-off-by-default.sql: dropspg_graphqlas the final migration step so new DBs start with the extension off. Down migration recreates it if available.20260421000001_rescope_pg_graphql_access_trigger.sql: fixes a pre-existing latent bug in thegrant_pg_graphql_accessevent trigger. Previously it fired onCREATE FUNCTIONand ran body logic for any function namedresolve, causing failures likeERROR: must be owner of function graphql_public.graphqlfor unrelated user code. The trigger now fires onCREATE EXTENSIONand early-exits unless the extension being created ispg_graphql.Wrapper attachment fix (inside the rescoped trigger)
Because
ddl_command_endfires after extension creation completes, the rebuiltgraphql_public.graphql(...)wrapper is not increating_extensioncontext and is not an extension member. Without an explicit attach,DROP EXTENSIONwould not cascade to the wrapper and theset_graphql_placeholdertrigger would not reinstall the "not enabled" stub. AddedALTER EXTENSION pg_graphql ADD FUNCTION graphql_public.graphql(...)inside the trigger body to make drop cascades work correctly.Schema dumps regenerated
migrations/schema-{15,17,orioledb-17}.sql: removedCREATE EXTENSION pg_graphql, added the standalone placeholdergraphql_public.graphql(), updatedgrant_pg_graphql_accessbody, flipped event trigger WHEN TAG fromCREATE FUNCTIONtoCREATE EXTENSION.Test expectations updated
nix/tests/expected/*evtrigs.out: row reordering only. The event trigger is recreated by the new migration, giving it a new OID and shifting row order in the output. No semantic changes.Version bumps
ansible/vars.yml: postgres releases tagged with-gql-offsuffix.Behavioral verification
Tested locally via psql:
CREATE EXTENSION pg_graphqlinstalls the real wrapper (plpgsql, prolang 13)DROP EXTENSION pg_graphqlreinstates the placeholder (sql, prolang 14)CREATE FUNCTION myapp.resolve(...)as non-superuser no longer triggersgrant_pg_graphql_accessand does not errorScope of impact
CREATE EXTENSION pg_graphqlrun_migrations()call in/infrastructure/init-scripts/project/00-init.shis sentinel-guarded, so these migrations run only at first bootTest plan
nix run .#docker-image-test)pg_graphqlis absent until explicitly enabledCREATE EXTENSION pg_graphqlstill installs cleanly on a fresh instanceDROP EXTENSION pg_graphqlreinstates the placeholder functionresolveno longer triggers the graphql wrapper replacement path