Skip to content

[Subtask]: Serve View introspection metadata through on-demand derivation #29439

Closed

Description

@ck89119

Parent Issue

Parent issue: #29433

Detail of Subtask

Phase S4. Depends on: #29437

Migrate metadata-reading surfaces to the common derived-schema boundary, including set-oriented queries and the raw-catalog contract explicitly selected in S1.

Deliverables:

  • Update DESC/SHOW COLUMNS, information_schema.columns, and subscription-column metadata. Cover additional protocol/internal introspection consumers identified by S1.
  • Keep base-table metadata reads on their existing efficient path; derive only the selected ordinary views.
  • Implement the approved mo_catalog.mo_columns compatibility/adapter policy. Do not claim migration complete while required direct-catalog consumers still observe an obsolete authority.
  • Preserve predicate, projection, JOIN, aggregation, ORDER BY, and LIMIT semantics for arbitrary information_schema queries. Push safe tenant/database/object filtering before derivation without incorrectly pushing output-dependent predicates or LIMIT.
  • Apply the approved visibility/authorization and row-column rewrite rules before disclosing results; avoid privilege escalation through metadata binding or privileged helper execution.
  • Define and implement single-object versus bulk invalid-view behavior. Do not silently report stale columns as current, or invent skip/abort behavior not approved in S1.
  • Bound batches, derived objects, nested work, and response memory; avoid binding once per output column and prevent recursion through system metadata views.

Acceptance criteria:

  • DESC/SHOW, information_schema, subscription surfaces, and the approved raw-catalog interface agree with planner output under equivalent schema visibility.
  • An unrelated invalid or invisible view cannot affect a narrowly scoped metadata query contrary to the approved filtering/error contract.
  • Public SQL and unit tests cover filtered and full-schema enumeration, composite SQL shapes, invalid views, empty results, authorization/rewrite visibility, cancellation, and bounded allocation.
  • No metadata read writes lifecycle state or starts a view data query; activation remains gated.

Describe implementation you've considered

Use a relational metadata provider/adapter at the approved ownership boundary, not one hidden SELECT or side-effecting scalar function per catalog column. Reuse visibility logic and statement-local derivation results. The precise catalog virtualization choice is a prerequisite decision, not deferred implementation guesswork.

Additional information

Current anchors: pkg/sql/plan/build_show.go; pkg/util/sysview/predefined.go; pkg/sql/colexec/table_function/subscription_metadata.go. Coordinate with #29095 for row-column rewrite visibility without absorbing unrelated fixes or claiming this task resolves them automatically.

Planning baseline: b9013dc6bb058ec74935a62ac3a35f57d13c2f98. This issue records future work, not completed implementation or fresh test evidence. All production work is subject to the approved versioned design from S1. Ordinary views only; materialized-view refresh and unrelated SQL compatibility work are out of scope.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions