Skip to content

PostgreSQL: Support ALTER TABLE ... ALTER CONSTRAINT - #3025

Open
LucaCappelletti94 wants to merge 1 commit into
mainfrom
upstream/pg-alter-table-alter-constraint
Open

LucaCappelletti94 wants to merge 1 commit into
mainfrom
upstream/pg-alter-table-alter-constraint

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Contributor

ALTER TABLE r ALTER CONSTRAINT f DEFERRABLE INITIALLY DEFERRED failed with Expected: SET/DROP NOT NULL, SET DEFAULT, SET DATA TYPE, ADD GENERATED, or OPTIONS after ALTER COLUMN, found: f, because the parser read CONSTRAINT as a column name with COLUMN omitted.

This PR adds AlterTableOperation::AlterConstraint for the two forms of the PostgreSQL synopsis, where the constraint name is followed either by ConstraintCharacteristics ([NOT] DEFERRABLE, INITIALLY ..., [NOT] ENFORCED) or by [NO] INHERIT.

PostgreSQL 18's grammar also takes NO INHERIT mixed with the others, but it rejects that mix on every constraint kind right after parsing, so I kept the two forms apart.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.52%. Comparing base (1187c8a) to head (6a4335f).

Files with missing lines Patch % Lines
src/ast/ddl.rs 75.00% 0 Missing and 2 partials ⚠️
src/ast/spans.rs 0.00% 1 Missing ⚠️
src/parser/mod.rs 93.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3025      +/-   ##
==========================================
- Coverage   83.52%   83.52%   -0.01%     
==========================================
  Files          42       42              
  Lines       35663    35687      +24     
  Branches    35663    35687      +24     
==========================================
+ Hits        29787    29807      +20     
- Misses       2438     2439       +1     
- Partials     3438     3441       +3     

☔ 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.

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