> So, please.. add INSERT OR UPDATE. I'd ask that INSERT OR REPLACE be > modified to do an UPDATE to the record if the UNIQUE Constraint is violated > instead of the delete, but that would break existing applications. > > Wasn't that the original intent of INSERT OR REPLACE?
No, because INSERT OR REPLACE can delete several rows and insert one row instead of that. This kind of operation cannot be covered by UPDATE in any way. Pavel On Thu, Mar 8, 2012 at 2:43 PM, Marc L. Allen <mlal...@outsitenetworks.com> wrote: >> > What happens if the intermediate delete breaks a foreign key >> constraint? And does it happen if the insert restores the foreign key? >> >> The constraint stops the DELETE, and the operation fails. Just like >> you were worried about. So instead of doing >> >> INSERT OR REPLACE ... >> >> you do >> >> INSERT OR IGNORE ... >> UPDATE ... > > But then I am back to the problem of large, ugly, and unwieldy UPDATE > statements for multiple columns and joins. > > I guess the easiest thing is to do the select and then iterate over the > records doing an UPDATE for each one. > > So, please.. add INSERT OR UPDATE. I'd ask that INSERT OR REPLACE be > modified to do an UPDATE to the record if the UNIQUE Constraint is violated > instead of the delete, but that would break existing applications. > > Wasn't that the original intent of INSERT OR REPLACE? > > Marc > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users