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

Support for WHEN NOT MATCHED BY SOURCE for MERGE statement [CORE6448] #6681

Closed
firebird-automations opened this issue Nov 17, 2020 · 6 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Leonardt (lxo)

It would be very useful to have the option "WHEN NOT MATCHED BY <SOURCE>/<TARGET>" for "MERGE statements".
Like for example in MSSQL.

Use case and example of how to use this in Firebird now without "WHEN NOT MATCHED BY <SOURCE>/<TARGET":
https://www.sql.ru/forum/1323218/merge-when-not-matched-by-source

I currently need this for mass copying.
When copying, I would like to take everything from the source, update matches, add new records and delete data not contained in the source from the target.

Without the merge statement I would first have to delete everything from the target and then insert it.
Or "Update or Insert "and then do a delete with "where not exists".

I see this new feature as very useful for such purposes. Therefore I don't understand why the request in a ticket was rejected years ago (CORE2515)

@firebird-automations
Copy link
Collaborator Author

Modified by: Leonardt (lxo)

security: Developers [ 10012 ] =>

@firebird-automations
Copy link
Collaborator Author

Modified by: Leonardt (lxo)

description: It would be very useful to have the option "WHEN NOT MATCHED BY <SOURCE>/<TARGET>" for "MERGE statements".
Like for example in MSSQL.

Use case and example of how to use this in Firebird:
https://www.sql.ru/forum/1323218/merge-when-not-matched-by-source

I currently need this for mass copying.
When copying, I would like to take everything from the source, update matches, add new records and delete data not contained in the source from the target.

Without the merge statement I would first have to delete everything from the target and then insert it.
Or "Update or Insert "and then do a delete with "where not exists".

I see this new feature as very useful for such purposes. Therefore I don't understand why the request in a ticket was rejected years ago (CORE2515)

=>

It would be very useful to have the option "WHEN NOT MATCHED BY <SOURCE>/<TARGET>" for "MERGE statements".
Like for example in MSSQL.

Use case and example of how to use this in Firebird now without "WHEN NOT MATCHED BY <SOURCE>/<TARGET":
https://www.sql.ru/forum/1323218/merge-when-not-matched-by-source

I currently need this for mass copying.
When copying, I would like to take everything from the source, update matches, add new records and delete data not contained in the source from the target.

Without the merge statement I would first have to delete everything from the target and then insert it.
Or "Update or Insert "and then do a delete with "where not exists".

I see this new feature as very useful for such purposes. Therefore I don't understand why the request in a ticket was rejected years ago (CORE2515)

@nLeonardt95
Copy link

Hello,

is this being considered for implementation in Firebird 4?

@hvlad
Copy link
Member

hvlad commented Apr 28, 2021

It is too late to consider new features for Firebird 4, sorry.

@asfernandes asfernandes self-assigned this Apr 28, 2021
asfernandes added a commit that referenced this issue Sep 2, 2021
- #6681 - Support for WHEN NOT MATCHED BY SOURCE for MERGE statement [CORE6448].
- #6942 - Incorrect singleton error with MERGE and RETURNING.
@asfernandes
Copy link
Member

Hello,

is this being considered for implementation in Firebird 4?

Could you please test it in next Firebird 5 snapshot?

@nLeonardt95
Copy link

First tests look good so far. Seems to work.

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

5 participants