Skip to content

PostgreSQL: Support ALTER COLUMN ... SET EXPRESSION AS (...) - #3023

Open
LucaCappelletti94 wants to merge 2 commits into
mainfrom
upstream/pg-alter-column-set-expression
Open

LucaCappelletti94 wants to merge 2 commits into
mainfrom
upstream/pg-alter-column-set-expression

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Contributor

As I am working on parsing pg_dumps of several different postgres versions, I have now encountered ALTER TABLE d ALTER COLUMN x SET EXPRESSION AS (y + 2), which PostgreSQL 17 added to replace the expression of a generated column (docs), failed with Expected: SET/DROP NOT NULL, SET DEFAULT, SET DATA TYPE, ADD GENERATED, or OPTIONS after ALTER COLUMN, found: SET.

This PR adds AlterColumnOperation::SetExpression, next to the DropExpression from #2999. The parentheses are required, as in PostgreSQL's grammar, so SET EXPRESSION AS y + 2 stays an error.

@codecov-commenter

codecov-commenter commented Nov 21, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.60%. Comparing base (ca4383f) to head (9ed17a5).

Files with missing lines Patch % Lines
src/ast/spans.rs 83.33% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3023   +/-   ##
=======================================
  Coverage   83.59%   83.60%           
=======================================
  Files          42       42           
  Lines       35732    35751   +19     
  Branches    35732    35751   +19     
=======================================
+ Hits        29871    29888   +17     
- Misses       2420     2422    +2     
  Partials     3441     3441           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@LucaCappelletti94
LucaCappelletti94 force-pushed the upstream/pg-alter-column-set-expression branch from 9251896 to 9ed17a5 Compare November 28, 2026 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants