Add opt-in schema-scoped PostgreSQL introspection - #2
Draft
Zetazzz wants to merge 8 commits into
Draft
Conversation
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
Add opt-in schema-scoped PostgreSQL introspection while preserving the exact
stock query and all existing parsing, caching, watch, registry, and entity-event
lifecycles.
pgService.schemasdependencies
Ownership boundary
pg-introspectionowns all PostgreSQL-specific behaviour:SchemaScopedIntrospectionPlan, which carries both the query and validationscope
typeByIdlookup handlinggraphile-build-pghas no separate scoped-introspection adapter module. Thesmall amount of Graphile-specific configuration, service validation, and
stock/scoped plan selection lives directly inside the existing
PgIntrospectionPlugin. It executes the selected query, validates the parsedresult with the same plan, and adds the PostgreSQL service name to validation
errors. It does not rebuild scope information or contain catalog traversal
logic.
This direct-integration design intentionally does not add a generic query hook
or an independent scoped plugin. The remaining trade-off is that the stock
plugin still knows the scoped configuration and selection policy.
Configuration
pgScopedIntrospectionis keyed by service name.trueuses defaults,falsekeeps stock introspection, and an object accepts
catalogTypesandcapabilityExtensions. Dependency schemas are discovered transitively; thereis no dependency-schema allowlist.
Validation
pg-introspection: package build passed; 46/46 tests passedc0ed817b912f78e1ea68c70d89ff4b7f9cb4c02d88112a69ac4109d5b996e4c5dependencies, dangling column types, and internal lookup-retained types
graphile-build-pg: package build passed; 23/23 tests passedexported adapter helpers
range/multirange, functions, foreign keys, inheritance, ordinary indexes,
and
pg_trgmGIN/GiST indexesgit diff --checkpassed; no lockfile, default-behaviour, or format-onlychanges