Skip to content

sql: inherit declared schema in materialized view replacements - #39603

Draft
antiguru wants to merge 2 commits into
mv-schema/declared-keysfrom
claude/mv-declared-schema-inherit
Draft

antiguru wants to merge 2 commits into
mv-schema/declared-keysfrom
claude/mv-declared-schema-inherit

Conversation

@antiguru

@antiguru antiguru commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

A replacement without a column list now gets its target's column definitions, so CREATE REPLACEMENT MATERIALIZED VIEW r FOR mv AS SELECT ... no longer has to repeat them.

Description

  • Purification copies the target's column definitions into the replacement statement, for CREATE and EXPLAIN CREATE. The replacement's create_sql states its schema, so re-planning it never depends on the target, and types used by the definitions are recorded as dependencies.
  • Inherited columns behave exactly like written-out ones: assignment casts, NOT NULL assertions, key proof, and the feature flag.
  • Applying the replacement needs no special case, since the replacement's column list is the target's.

A replacement with a bare-name list for a declared target is still rejected.

The sqllogictest and platform check changes are unverified locally.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NrWZDcjDrqsHdkVGSrhuUj

@antiguru
antiguru added this pull request to stack #39604 October 6, 2026 20:24
A replacement without a column list for a materialized view with a
declared schema gets the target's column definitions during
purification. The replacement's `create_sql` then states its schema,
so re-planning it does not depend on the target, dependencies on types
used by the definitions are recorded, and applying the replacement
keeps the target's schema declared. Inherited columns behave like
written-out ones, including assignment casts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@antiguru
antiguru force-pushed the claude/mv-declared-schema-inherit branch from 54314ef to 0346bcb Compare October 7, 2026 07:04
@antiguru
antiguru removed this pull request from stack #39604 October 7, 2026 07:04
@antiguru
antiguru changed the base branch from claude/mv-declared-schema-impl to mv-schema/declared-keys October 7, 2026 07:04
@antiguru
antiguru added this pull request to stack #39622 October 7, 2026 07:04

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.

2 participants