Skip to content

PostgreSQL: Support column lists in ON DELETE SET NULL and SET DEFAULT - #3024

Open
LucaCappelletti94 wants to merge 1 commit into
mainfrom
upstream/pg-referential-action-set-column-list
Open

LucaCappelletti94 wants to merge 1 commit into
mainfrom
upstream/pg-referential-action-set-column-list

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Contributor

PostgreSQL 15 onwards lets ON DELETE SET NULL and ON DELETE SET DEFAULT name the columns they reset, so CREATE TABLE c (a INT, b INT, FOREIGN KEY (a, b) REFERENCES r ON DELETE SET NULL (b)) clears only b. The parser stopped after SET NULL and failed with Expected: ',' or ')' after column definition, found: (, and the same happened for column-level REFERENCES and for ALTER TABLE ... ADD FOREIGN KEY.

This PR gives ReferentialAction::SetNull and SetDefault a Vec<Ident>, empty when no list is written, so the enum is no longer Copy. The list is also accepted after ON UPDATE, because PostgreSQL's grammar takes it there and only rejects it during analysis.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

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

Files with missing lines Patch % Lines
src/ast/ddl.rs 81.81% 0 Missing and 2 partials ⚠️
src/ast/spans.rs 66.66% 1 Missing ⚠️
src/parser/mod.rs 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3024   +/-   ##
=======================================
  Coverage   83.52%   83.52%           
=======================================
  Files          42       42           
  Lines       35663    35670    +7     
  Branches    35663    35670    +7     
=======================================
+ Hits        29787    29795    +8     
+ Misses       2438     2436    -2     
- Partials     3438     3439    +1     

☔ 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