feat(catalog): virtual system catalog (information_schema + pg_catalog) - #31
Merged
Conversation
ORMs and SQL tools introspect the catalog on connect; this answers those
queries. Adds virtual system relations that generate rows from existing
catalog metadata at read time (no stored copy, always consistent):
- information_schema.{schemata, tables, columns}
- pg_catalog.{pg_database, pg_namespace, pg_class, pg_attribute, pg_type},
resolvable qualified or unqualified (search-path style)
- st_* canonical spellings (st_class, st_type, …) aliased to the same
generators
A type-OID table maps each LogicalType to its canonical Postgres type OID
(int4=23, text=25, numeric=1700, uuid=2950, …) — the same map the wire
RowDescription should eventually send.
Mechanism: a SystemRelation enum owns each relation's schema + row
generation; the binder intercepts system names (1/2/3-part) into a new
LogicalNode/PlanNode::SystemScan, which the Volcano executor fills by
enumerating projects/datasets/tables via CatalogReader. Reshaping blob
metadata into columnar catalog rows is why a dedicated node exists (vs a
plain SeqScan); a real VIEW system would subsume it later.
Covered by system_catalog.slt. Wire column *names* (RowDescription) are
still generic for all queries — a separate follow-up for full ORM use.
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
Adds a virtual system catalog so ORMs and SQL tools that introspect on connect get answers. Rows are generated from existing catalog metadata at read time — no stored copy, always consistent.
information_schema.{schemata, tables, columns}pg_catalog.{pg_database, pg_namespace, pg_class, pg_attribute, pg_type}, resolvable qualified or unqualified (search-path style)st_*canonical spellings (st_class,st_type, …) aliased to the same generatorsLogicalTypeto its canonical Postgres type OID (int4=23, text=25, numeric=1700, uuid=2950, …)Mechanism
A
SystemRelationenum owns each relation's schema + row generation. The binder intercepts system names (1/2/3-part) into a newLogicalNode/PlanNode::SystemScan, which the Volcano executor fills by enumerating projects/datasets/tables viaCatalogReader.Testing
Covered by
system_catalog.slt. Wire column names (RowDescription) are still generic — a separate follow-up for full ORM use.🤖 Generated with Claude Code