Skip to content

feat(catalog): virtual system catalog (information_schema + pg_catalog) - #31

Merged
nevzheng merged 1 commit into
mainfrom
feat/system-catalog
Jun 14, 2026
Merged

feat(catalog): virtual system catalog (information_schema + pg_catalog)#31
nevzheng merged 1 commit into
mainfrom
feat/system-catalog

Conversation

@nevzheng

Copy link
Copy Markdown
Owner

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 generators
  • A type-OID table mapping each LogicalType to its canonical Postgres type OID (int4=23, text=25, numeric=1700, uuid=2950, …)

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.

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

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.
@nevzheng
nevzheng merged commit 3772158 into main Jun 14, 2026
5 checks passed
@nevzheng
nevzheng deleted the feat/system-catalog branch June 14, 2026 04:04
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.

1 participant