update only if different
------------------------

                 Key: CORE-3684
                 URL: http://tracker.firebirdsql.org/browse/CORE-3684
             Project: Firebird Core
          Issue Type: New Feature
            Reporter: Philip Williams
            Priority: Trivial


Allow update and insert-or-update statements to have a flag for "no trivial 
changes", if the update would have no effect except locking the row. Something 
like "update people set name = 'Bob' where id = 5 ONLY IF DIFFERENT". This is 
useful for migration / data-loading scenarios where you're running large import 
datasets, but you just want the data to end up a certain way, you don't want 
record locks / versions on rows that didn't really need to be touched. It'd be 
entirely optional, only for situations where you know you don't want do-nothing 
updates to trigger on-update triggers or place locks, and you're okay with it. 
To accomplish this currently, a simple:

update or insert into people (name, id) values ('Bob', 5);

becomes

if (not exists(select id from people where id = 5)) then insert into people 
(name, id) values ('Bob', 5)
else update people set name = 'Bob' where id = 5 and name is distinct from 
'Bob'; 
-- not so bad for one field, but much more annoying for high-column-count tables

I know it's a very niche feature.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to