Re: [sqlite] Bug? INSERT OR REPLACE not equivalent to DELETE followed by INSERT

2018-03-12 Thread Keith Medcalf
On this page, 7th paragrph: https://www.sqlite.org/lang_createtrigger.html See that: An ON CONFLICT clause may be specified as part of an UPDATE or INSERT action within the body of the trigger. However if an ON CONFLICT clause is specified as part of the statement causing the trigger to

Re: [sqlite] Bug? INSERT OR REPLACE not equivalent to DELETE followed by INSERT

2018-03-12 Thread Keith Medcalf
The parent is still being deleted and inserted, however, the trigger now uses the REPLACE conflict resolution method rather than the IGNORE resolution method and that resolution method causes the deletion and insertion of a new child record. --- The fact that there's a Highway to Hell but

[sqlite] Bug? INSERT OR REPLACE not equivalent to DELETE followed by INSERT

2018-03-12 Thread Peter Michaux
Hi, I have read that INSERT OR REPLACE is equivalent to a DELETE followed by an INSERT. I came across a case where that is not true. Set up a test case $ rm -f asdf.sqlite && sqlite3 asdf.sqlite sqlite> .mode columns sqlite> .headers on sqlite> PRAGMA foreign_keys=OFF;

Re: [sqlite] [EXTERNAL] Re: Selecting a non-unique column name in a WHERE clause

2018-03-12 Thread Hick Gunter
Using the shortcut '*' for a field list only work if you don't care about column names. SQLite will pick column names for you that may or may not be intuitive and that may change between releases of SQLite. As soon as you find yourself trying to guess column names, you should throw away '*'