Add opt-in schema-scoped PostgreSQL introspection - #2
Draft
Zetazzz wants to merge 5 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
pg-introspection;PgIntrospectionPluginopt in per PostgreSQL service through native gather options;Services without a
gather.pgScopedIntrospectionentry continue to use the existing full-catalog query. This PR does not change the default preset or PostgreSQL JIT/session settings.Configuration
The service configuration accepts a boolean shorthand or an options object:
false: use stock introspection;true: use scoped introspection with defaults;{ ... }: use scoped introspection with custom options;The map key is the PostgreSQL service name. Root schemas come from the service's
schemasfield; referenced objects in other schemas are discovered and retained automatically, while unrelated objects are excluded. Configuration for an unknown service fails rather than being silently ignored.Extensions required by retained objects are discovered automatically.
capabilityExtensionsretains lightweight installation metadata for extensions that no retained object directly depends on—for example, so a plugin can detectpg_trgmbefore exposing an optional search capability. It does not install the extension or retain every extension-owned object.Correctness coverage
The real PostgreSQL fixture covers automatically discovered cross-schema enum, domain, composite, range/multirange, function signature, foreign-key and inheritance dependencies; ordinary and
pg_trgmGIN/GiST indexes; explicit extension capability metadata; unrelated schema exclusion; stock/scoped GraphQL SDL equality; and runtime execution.Performance evidence
The same query/closure implementation was measured in constructive#1763 with 10 fresh-process samples per arm and identical JIT-off sessions. On the 65,037-
pg_classfixture:The small fixture showed a 1.9% build-time overhead, so this remains explicitly opt-in. The benchmark controlled JIT externally; this PR intentionally does not manage it.
Validation
pg-introspection: 41 tests passed; build passedgraphile-build-pg: 22 tests / 3 suites passed, including real PostgreSQL scoped coverage; build passedgit diff --checkand format-only diff audit passed