Skip to content

PostgreSQL: Support ALTER DOMAIN - #2796

Open
LucaCappelletti94 wants to merge 5 commits into
mainfrom
upstream/alter-domain
Open

LucaCappelletti94 wants to merge 5 commits into
mainfrom
upstream/alter-domain

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Contributor

ALTER DOMAIN d1 SET DEFAULT 0, and every other form of the statement, fails with Expected: one of VIEW or TYPE or COLLATION or TABLE ..., found: DOMAIN, because parse_alter has no DOMAIN arm.

Statement::AlterDomain now wraps an AlterDomain struct holding the domain name and an AlterDomainOperation, the shape AlterCollation already uses, and covers all eleven operations in the PostgreSQL grammar. A domain constraint can only be NOT NULL or CHECK, so ADD parses into a new DomainConstraint enum with those two variants, and ALTER DOMAIN d ADD PRIMARY KEY (VALUE) is refused as PostgreSQL refuses it. The CHECK body parsing moves into a helper that table constraints share. Like CREATE DOMAIN and ALTER COLLATION, the statement is not gated on the dialect.

I reckon one very api breaking thing we might want to do at some point is to group the statements by things like Drop, Alter, Create and so on.

@codecov-commenter

codecov-commenter commented Nov 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.14%. Comparing base (1071d75) to head (14c1a48).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2796      +/-   ##
==========================================
+ Coverage   83.09%   83.14%   +0.05%     
==========================================
  Files          42       42              
  Lines       36261    36358      +97     
  Branches    36261    36358      +97     
==========================================
+ Hits        30130    30231     +101     
  Misses       2636     2636              
+ Partials     3495     3491       -4     

☔ 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