Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow the use of multiple WHEN MATCHED / NOT MATCHED clauses in MERGE, as per the SQL 2008 specification [CORE3639] #3990

Closed
firebird-automations opened this issue Oct 20, 2011 · 5 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @asfernandes

Votes: 2

Combined with WHEN conditions, this makes MERGE very powerful.

Commits: 9f16366 372d48c FirebirdSQL/fbt-repository@a1a4b7b

====== Test Details ======

Verified that one may use MERGE which contains up to 254 WHEN-conditions (with trivial statements like: when NOT matched and http://s.id = 254 then insert values(http://s.id, s.x) or when matched and http://s.id = 254 then update set t.x = t.x + s.x).

::: NB :::
JFYI: Statement MERGE ... RETURNING will fail always if SOURCE contain more than 1 row. Even if MERGE condition doesn not affected more than one record in TARGET.
Discussion (rus): http://sql.ru/forum/actualutils.aspx?action=gotomsg&tid=1159066&msg=17706227

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 3.0 Alpha 1 [ 10331 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: Done successfully

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

Test Details: Verified that one may use MERGE which contains up to 254 WHEN-conditions (with trivial statements like: when NOT matched and http://s.id = 254 then insert values(http://s.id, s.x) or when matched and http://s.id = 254 then update set t.x = t.x + s.x).

::: NB :::
JFYI: Statement MERGE ... RETURNING will fail always if SOURCE contain more than 1 row. Even if MERGE condition doesn not affected more than one record in TARGET.
Discussion (rus): http://sql.ru/forum/actualutils.aspx?action=gotomsg&tid=1159066&msg=17706227

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Closed [ 6 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants