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

Extent/Improvement in merge - support check operation in update clause [CORE3128] #3505

Closed
firebird-automations opened this issue Sep 8, 2010 · 7 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @livius2

Duplicates CORE2005

now merge operation look like
MERGE
INTO customers c
USING (SELECT * FROM customers_delta WHERE id > 10) cd
ON (http://c.id = http://cd.id)
WHEN MATCHED THEN
UPDATE SET
name = http://cd.name
WHEN NOT MATCHED THEN
INSERT (id, name)
VALUES (http://cd.id, http://cd.name)

will be good if we can check field values before update/or not update
example

MERGE
INTO customers c
USING (SELECT * FROM customers_delta WHERE id > 10) cd
ON (http://c.id = http://cd.id)
WHEN MATCHED THEN
IF (name<>http://cd.name) THEN /* here is modification in merge statement */
UPDATE SET
name = http://cd.name
WHEN NOT MATCHED THEN
INSERT (id, name)
VALUES (http://cd.id, http://cd.name)

This modification reduced the number of versions of record
because we only update record when the condition is met

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

issuetype: New Feature [ 2 ] => Improvement [ 4 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

Accordingly to the SQL specification, this should look this way:

WHEN MATCHED AND (NAME <> http://CD.NAME) THEN UPDATE ...

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

This is already done in FB 3. See CORE2005.

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

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

resolution: Duplicate [ 3 ]

Fix Version: 3.0 Alpha 1 [ 10331 ]

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

Link: This issue duplicates CORE2005 [ CORE2005 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

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

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Fix Version: 3.0 Alpha 1 [ 10331 ] =>

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