Skip to content

fix(clickhouse): parse MODIFY COLUMN as AlterColumn - #8091

Open
dgvj-work wants to merge 2 commits into
tobymao:mainfrom
dgvj-work:fix/clickhouse-modify-column-parse
Open

fix(clickhouse): parse MODIFY COLUMN as AlterColumn#8091
dgvj-work wants to merge 2 commits into
tobymao:mainfrom
dgvj-work:fix/clickhouse-modify-column-parse

Conversation

@dgvj-work

@dgvj-work dgvj-work commented Aug 7, 2026

Copy link
Copy Markdown

ClickHouse treats MODIFY COLUMN and ALTER COLUMN as equivalent. MODIFY COLUMN was falling back to Command because the ClickHouse MODIFY alter parser only handled MODIFY SQL SECURITY ....

This maps MODIFY through the alter-column parser (same idea as Snowflake), returns AlterColumn, and canonicalizes generation to ALTER COLUMN ... TYPE. IF EXISTS is parsed on AlterColumn and emitted for ClickHouse. Forms the base parser cannot consume (for example REMOVE) still fall back to Command.

Follow-up to #8020 addressing @treysp's review feedback.

Fixes #8019

ClickHouse treats MODIFY COLUMN and ALTER COLUMN as equivalent, so map
MODIFY through the alter-column parser and return AlterColumn. Generation
canonicalizes to ALTER COLUMN ... TYPE. IF EXISTS is parsed on AlterColumn
and emitted when the dialect supports it.

Fixes tobymao#8019
Handle unsupported ALTER COLUMN IF EXISTS with an explicit check instead
of decorating altercolumn_sql overrides, which failed sqlglotc builds.
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.

ClickHouse MODIFY COLUMN falls back to Command instead of Alter

1 participant