Skip to content

[catalog] convert mz_sources table to materialized view#36674

Open
mtabebe wants to merge 1 commit into
MaterializeInc:mainfrom
mtabebe:ma/convert-builtins/mz-sources
Open

[catalog] convert mz_sources table to materialized view#36674
mtabebe wants to merge 1 commit into
MaterializeInc:mainfrom
mtabebe:ma/convert-builtins/mz-sources

Conversation

@mtabebe
Copy link
Copy Markdown
Contributor

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

@mtabebe mtabebe force-pushed the ma/convert-builtins/mz-sources branch from 9e1f06d to a5483b4 Compare May 21, 2026 16:24
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 mtabebe force-pushed the ma/convert-builtins/mz-sources branch from a5483b4 to b17477f Compare May 21, 2026 17:33
@mtabebe mtabebe marked this pull request as ready for review May 21, 2026 19:22
@mtabebe mtabebe requested review from a team as code owners May 21, 2026 19:22
@mtabebe mtabebe requested review from SangJunBak and aljoscha and removed request for a team May 21, 2026 19:22
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