Skip to content

catalog,adapter: convert mz_sources table to materialized view#36136

Draft
teskje wants to merge 1 commit into
MaterializeInc:mainfrom
teskje:convert-mz_sources
Draft

catalog,adapter: convert mz_sources table to materialized view#36136
teskje wants to merge 1 commit into
MaterializeInc:mainfrom
teskje:convert-mz_sources

Conversation

@teskje
Copy link
Copy Markdown
Contributor

@teskje teskje commented Apr 17, 2026

This commit converts the mz_sources builtin table into a view over the
catalog. As part of this, it introduces an internal mz_builtin_sources
view exposing the builtin indexes to SQL.

Motivation

Part of SQL-118

@teskje teskje force-pushed the convert-mz_sources branch from da01428 to 803a2ea Compare April 17, 2026 08:32
@teskje teskje force-pushed the convert-mz_sources branch from 803a2ea to 7585228 Compare April 21, 2026 14:37
mtabebe added a commit to mtabebe/materialize that referenced this pull request May 21, 2026
Problem:
mz_sources was a builtin table populated imperatively in Rust code in
builtin_table_updates.rs.

Ideologically we want to move these to views over the catalog.

Solution:
Convert mz_sources into a materialized view that reads directly from
mz_catalog_raw. User sources are derived by parsing their stored
create_sql. Builtin and log sources, which don't appear in
mz_catalog_raw, are exposed via a new internal view
mz_internal.mz_builtin_sources

Testing:
- Updated information_schema_tables.slt to expect MATERIALIZED VIEW
for mz_sources
- Added mz_builtin_sources to mz_internal.slt and
mz_catalog_server_index_accounting.slt
- updated catalog.td to move mz_sources from the tables section into
the materialized views section.

Part of SQL-118.

Port of MaterializeInc#36136 (adapted for the split builtin
file structure and current OID range).
mtabebe added a commit to mtabebe/materialize that referenced this pull request May 21, 2026
Problem:
mz_sources was a builtin table populated imperatively in Rust code in
builtin_table_updates.rs.

Ideologically we want to move these to views over the catalog.

Solution:
Convert mz_sources into a materialized view that reads directly from
mz_catalog_raw. User sources are derived by parsing their stored
create_sql. Builtin and log sources, which don't appear in
mz_catalog_raw, are exposed via a new internal view
mz_internal.mz_builtin_sources

Testing:
- Updated information_schema_tables.slt to expect MATERIALIZED VIEW
for mz_sources
- Added mz_builtin_sources to mz_internal.slt and
mz_catalog_server_index_accounting.slt
- updated catalog.td to move mz_sources from the tables section into
the materialized views section.

Part of SQL-118.

Port of MaterializeInc#36136 (adapted for the split builtin
file structure and current OID range).
mtabebe added a commit to mtabebe/materialize that referenced this pull request May 21, 2026
Problem:
mz_sources was a builtin table populated imperatively in Rust code in
builtin_table_updates.rs.

Ideologically we want to move these to views over the catalog.

Solution:
Convert mz_sources into a materialized view that reads directly from
mz_catalog_raw. User sources are derived by parsing their stored
create_sql. Builtin and log sources, which don't appear in
mz_catalog_raw, are exposed via a new internal view
mz_internal.mz_builtin_sources

Testing:
- Updated information_schema_tables.slt to expect MATERIALIZED VIEW
for mz_sources
- Added mz_builtin_sources to mz_internal.slt and
mz_catalog_server_index_accounting.slt
- updated catalog.td to move mz_sources from the tables section into
the materialized views section.

Part of SQL-118.

Port of MaterializeInc#36136 (adapted for the split builtin
file structure and current OID range).
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