Skip to content

draft: Implement type builtin relations - #40067

Draft
SangJunBak wants to merge 4 commits into
mainfrom
jun/type-relations
Draft

SangJunBak wants to merge 4 commits into
mainfrom
jun/type-relations

Conversation

@SangJunBak

@SangJunBak SangJunBak commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Closes sql-495

Motivation

Why does this change exist? Link to a GitHub issue, design doc, Slack
thread, or explain the problem in a sentence or two. A reviewer who has
no context should understand why after reading this section.

If this implements or addresses an existing issue, it's enough to link to that:
Closes
Fixes
etc.

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.

@linear-code

linear-code Bot commented Oct 21, 2026

Copy link
Copy Markdown

SQL-495

SangJunBak and others added 4 commits November 4, 2026 17:02
Adds three generated constant views that report builtin objects:
mz_internal.mz_builtin_types, mz_internal.mz_builtin_functions and
mz_internal.mz_builtin_operators. They join the other mz_builtin_* views
in mz_builtin_views and mz_builtin_columns. builtin_types_ctes and
builtin_signature_ctes resolve builtin type names to catalog ids through
GidMapping records in mz_catalog_raw.

catalog-decode now decodes CREATE TYPE statements: the type kind and
category, plus the element, key and value type ids and modifiers of list
and map types, so the type relations can report user-defined types from
mz_catalog_raw.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…_raw

Converts the builtin tables mz_types, mz_array_types, mz_base_types,
mz_list_types, mz_map_types, mz_pseudo_types, mz_type_pg_metadata,
mz_functions and mz_operators to materialized views over mz_catalog_raw,
and mz_aggregates to a view over mz_builtin_functions. Builtin rows come
from the generated mz_builtin_types, mz_builtin_functions and
mz_builtin_operators views, user-defined types from their decoded
CREATE TYPE statements.

pg_aggregate declares the oid key it now derives through mz_aggregates.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The type, function and operator relations are derived from
mz_catalog_raw, so pack_item_update no longer packs rows for types and
functions, and catalog open no longer packs a row per operator.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tor relations

Adds replacement migration steps for the converted relations, records
their conversion version for the builtin version pin platform check, and
updates the generated docs and the sqllogictest and testdrive
expectations.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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