On Wed, 13 Nov 2013 19:03:44 +0000
Simon Slavin <slav...@bigfraud.org> wrote:

> I'm wondering what particular thing MERGE does that this person
> needs, which doesn't happen if they use just the single commands
> INSERT OR REPLACE or UPDATE OR REPLACE.

On Wed, 13 Nov 2013 20:31:25 +0100
Petite Abeille <petite.abei...@gmail.com> wrote:

> There are no equivalent in SQLite at all. One cannot do even the most
> basic of upsert with the SQL available. The functionality is just not
> there. In other words, one cannot perform an insert or update combo
> without resorting to procedural programming outside of SQLite.

http://www.schemamania.org/sql/#some.rows

The logical equivalent of MERGE is accomplished by one INSERT and one
UPDATE inside a user-defined transaction.  Given SQLite's locking
semantics, it's atomic.  Nothing procedural about it.  

INSERT OR REPLACE and UPDATE OR REPLACE, on the other hand, have
terrible, nonstandard semantics.  They should be avoided now
and abolished later.  They are not equivalent to MERGE, and seem mostly
to confuse the issue.  

I don't see a need for SQLite to support MERGE, given that UPDATE &
INSERT do the job just as well, with hardly any more effort.  

--jkl
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to