Repository navigation
Convert mz_columns and mz_index_columns to builtin mvs - #39427
Draft
SangJunBak wants to merge 8 commits into
Draft
SangJunBak wants to merge 8 commits into
SangJunBak wants to merge 8 commits into
Conversation
SangJunBak
force-pushed
the
jun/sql-494-convert-mz_columns-and-mz_index_columns-to-catalog-views
branch
from
October 6, 2026 19:49
a659af0 to
27c8872
Compare
SangJunBak
added this pull request to stack #38849
October 6, 2026 19:56
SangJunBak
force-pushed
the
jun/sql-494-convert-mz_columns-and-mz_index_columns-to-catalog-views
branch
from
October 9, 2026 15:29
27c8872 to
7857df2
Compare
SangJunBak
force-pushed
the
jun/sql-494-convert-mz_columns-and-mz_index_columns-to-catalog-views
branch
from
October 9, 2026 15:34
7857df2 to
3a32217
Compare
SangJunBak
force-pushed
the
jun/sql-494-convert-mz_columns-and-mz_index_columns-to-catalog-views
branch
from
October 13, 2026 17:38
3a32217 to
27a429d
Compare
SangJunBak
force-pushed
the
jun/sql-494-convert-mz_columns-and-mz_index_columns-to-catalog-views
branch
from
October 14, 2026 08:57
27a429d to
3c03c63
Compare
SangJunBak
force-pushed
the
jun/sql-494-convert-mz_columns-and-mz_index_columns-to-catalog-views
branch
3 times, most recently
from
October 14, 2026 13:08
d50422a to
2194479
Compare
mz_type_name only knew the PostgreSQL types, since Type::from_oid cannot reconstruct a list, map or record from an OID alone. Type gains name_of_oid, which also names Materialize's own types and the list, map and record pseudo-types, and a test checks it covers every type a column can present as. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…e_sql parse_catalog_create_sql reports a table's DEFAULT clauses by column name, with NULL for a column without one, and an index's key expressions in index order, so that catalog views can read both without a planner. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Builtin relations have no item in mz_catalog_raw, so a generated mz_builtin_columns view inlines every builtin relation's declared columns, its own and mz_builtin_views' included. The keys of builtin indexes and of the introspection source indexes are resolved against the declared descs of the relations they index by a generated mz_builtin_index_columns view, the way mz_builtin_indexes and mz_builtin_log_indexes serve mz_indexes. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ized views mz_columns reads the ItemColumn rows each relation records in mz_catalog_raw: the recorded OID and type modifier present the type through mz_type_name, and a column of a CREATE TYPE list, map or record takes the name and OID of that type's item instead. A table's column defaults are the DEFAULT clauses of its create_sql, read through parse_catalog_create_sql. Builtin relations' columns come from mz_builtin_columns, joined to the builtin object mappings. mz_index_columns reads the IndexColumn rows each index records, with the key expressions as written in create_sql. Builtin and introspection source index keys come from mz_builtin_index_columns, joined to the builtin index mappings and to the per-cluster introspection source index records. Both packers go away, and each relation gets a replacement migration step. Closes: SQL-494 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…materialized views Plans, builtin object listings and OIDs change with the two relations becoming materialized views and with the generated mz_builtin_columns and mz_builtin_index_columns views. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The sqllogictests pin the schema, the builtin, introspection and user rows for every relation kind and key shape, and retraction. Their expectations were captured from the builtin tables before the conversion and hold for the views, except that a table's defaults read as written. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The ItemColumns platform check creates tables, views, materialized views and indexes with column and expression keys in every phase, adds columns with ALTER TABLE, and comments on columns. It then checks what mz_columns and mz_index_columns report and that the reported positions join with the comments. In the upgrade scenarios the objects created before the upgrade get their recorded rows from the bootstrap refresh. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…x-selects The mz_type_name body change makes the scalar function registry source snapshot stale. mz_columns.slt and mz_index_columns.slt assert on allocated item ids and type OIDs and list every user object, which --auto-index-selects perturbs by creating wrapper views and indexes.
SangJunBak
force-pushed
the
jun/sql-494-convert-mz_columns-and-mz_index_columns-to-catalog-views
branch
from
October 14, 2026 14:40
2194479 to
ea159b9
Compare
SangJunBak
removed this pull request from stack #38849
October 14, 2026 14:41
SangJunBak
added this pull request to stack #39819
October 14, 2026 14:41
This branch has not been deployed
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.
Motivation
Closes SQL-494
Description
What does this PR actually do? Focus on the approach and any non-obvious
decisions. The diff shows the code --- use this space to explain what the
diff can't tell a reviewer.
Verification
How do you know this change is correct? Describe new or existing automated
tests, or manual steps you took.