Skip to content

Parse PostgreSQL MERGE DO NOTHING actions - #2468

Open
LucaCappelletti94 wants to merge 1 commit into
apache:mainfrom
LucaCappelletti94:pg-merge-do-nothing
Open

Parse PostgreSQL MERGE DO NOTHING actions#2468
LucaCappelletti94 wants to merge 1 commit into
apache:mainfrom
LucaCappelletti94:pg-merge-do-nothing

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Contributor

MERGE ... WHEN MATCHED THEN DO NOTHING currently fails because merge action parsing only recognizes UPDATE, DELETE, and INSERT.

DO NOTHING has no payload, so it is represented as MergeAction::DoNothing while retaining both keyword spans.

@LucaCappelletti94
LucaCappelletti94 marked this pull request as ready for review August 31, 2026 13:28
Comment thread tests/sqlparser_postgres.rs Outdated
#[test]
fn reject_merge_do_without_nothing() {
assert_eq!(
pg().parse_sql_statements(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change isn't dialect gated so probably needs to be tested with pg_and_generic()?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RIght, done

Comment thread src/parser/merge.rs Outdated
]) {
Some(Keyword::DO) => {
let do_token = self.get_current_token().clone();
self.expect_keyword_is(Keyword::NOTHING)?;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: Could shorten to let nothing_token = self.expect_keyword(Keyword::NOTHING)?;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And done

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.

2 participants