Skip to content

feat(query): reject alter view definition changes - #20202

Merged
youngsofun merged 1 commit into
databendlabs:mainfrom
youngsofun:codex/reject-alter-view-query-changes
Jul 24, 2026
Merged

feat(query): reject alter view definition changes#20202
youngsofun merged 1 commit into
databendlabs:mainfrom
youngsofun:codex/reject-alter-view-query-changes

Conversation

@youngsofun

@youngsofun youngsofun commented Jul 24, 2026

Copy link
Copy Markdown
Member

I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/

Summary

Reject ALTER VIEW operations that replace a view's query or output-column definition.

This change was split out of the data-lineage PR #20198 so its behavioral impact can be reviewed independently. #20198 no longer contains or depends on this commit. Merging this PR first would nevertheless give lineage a simpler invariant: a view's stored definition cannot change without replacing the view and its dependency metadata together.

Motivation

The current ALTER VIEW <name> [(columns)] AS <query> path replaces the stored SQL definition in place. Once view dependencies are persisted, allowing this operation without atomically replacing all object and column lineage can leave metadata describing the previous query.

For now, the binder returns Unimplemented for query-definition changes. The existing view remains unchanged after a rejected statement.

This does not affect independent operations such as setting tags. CREATE OR REPLACE VIEW remains the explicit replacement path. A future change can add:

ALTER VIEW <name> RENAME TO <new_name>

when rename semantics are implemented.

The obsolete ALTER VIEW definition-replacement sqllogic suite is removed, and the existing CREATE VIEW suite verifies that a rejected ALTER does not damage the view.

Tests

  • Unit Test
  • Logic Test
  • Benchmark Test
  • No Test - Explain why

Type of change

  • Bug Fix (non-breaking change which fixes an issue)
  • New Feature (non-breaking change which adds functionality)
  • Breaking Change (fix or feature that could cause existing functionality not to work as expected)
  • Documentation Update
  • Refactoring
  • Performance Improvement
  • Other (please describe):

This change is Reviewable

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@github-actions github-actions Bot added the pr-feature this PR introduces a new feature to the codebase label Jul 24, 2026
@youngsofun
youngsofun requested a review from TCeason July 24, 2026 09:28
@youngsofun youngsofun mentioned this pull request Jul 24, 2026
11 tasks
@youngsofun
youngsofun requested review from b41sh and bohutang July 24, 2026 09:29
@TCeason

TCeason commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

LGTM. Please modify the doc.

@youngsofun
youngsofun added this pull request to the merge queue Jul 24, 2026
Merged via the queue into databendlabs:main with commit 7117b1f Jul 24, 2026
96 checks passed
@youngsofun
youngsofun deleted the codex/reject-alter-view-query-changes branch July 24, 2026 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-feature this PR introduces a new feature to the codebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants