shlomi-noach / openarkkit

Automatically exported from code.google.com/p/openarkkit
24 stars 16 forks source link

oak-online-alter-table: No need for DELETE in the UPDATE-Trigger #10

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

What steps will reproduce the problem?
1. No problem just a design improvement?

What is the expected output? What do you see instead?
no difference

What version of the product are you using? On what operating system?
openark-kit-170

Please provide any additional information below.

A trigger is used:
        CREATE TRIGGER %s.%s AFTER UPDATE ON %s.%s
        FOR EACH ROW
        BEGIN
            DELETE FROM %s.%s WHERE (%s) = (%s);
            REPLACE INTO %s.%s (%s) VALUES (%s);
        END

Imho there is no need for the DELETE

Regards
Erkan

Original issue reported on code.google.com by erkats...@googlemail.com on 28 Mar 2011 at 12:47

GoogleCodeExporter commented 9 years ago
The DELETE is required.
Reason: suppose someone was to UPDATE one of columns on the unique key used for 
chunking.
In this case, the REPLACE fails to remove mention of original row. This is why 
the DELETE is there.

I'll add comment in the code clarifying that. Thank you.

Original comment by shlomi.n...@gmail.com on 7 Apr 2011 at 6:12

GoogleCodeExporter commented 9 years ago
Have added clarifying comment (rev 182)

Original comment by shlomi.n...@gmail.com on 7 Apr 2011 at 6:14