Re: [sqlite] upsert from select

2018-11-30 Thread R Smith
On 2018/11/30 12:50 PM, Eric Grange wrote: Apparently adding just a "WHERE 1" clause is enough... Indeed, glad it works. PS: I used "wcount" rather because "count" is an internal SQL function. Indeed, though it seems to be accepted here, I am not using a field with my name in may actual

Re: [sqlite] upsert from select

2018-11-30 Thread Eric Grange
Thanks! Apparently adding just a "WHERE 1" clause is enough, ie. this passes INSERT INTO vocabulary(word, count) SELECT * FROM (SELECT 'jovial', 1) WHERE 1 ON CONFLICT(word) DO UPDATE SET count=count+1 and the "WHERE 1" also makes the query with a json_each pass (not just in the snippet I

Re: [sqlite] upsert from select

2018-11-30 Thread R Smith
This does seem like a small bug. While the SQLite devs are having a look, this Zero-cost work-around might suit your needs: Simply add a WHERE clause, for example: CREATE TABLE vocabulary (   word TEXT NOT NULL PRIMARY KEY,   wcount INT DEFAULT 1 ); WITH A(w) AS (   SELECT 'jovial' UNION ALL

[sqlite] upsert from select

2018-11-30 Thread Eric Grange
Hi, I am running into a little trouble when trying to use and "upsert" from a select clause. Starting from the "vocabulary" exemple at https://sqlite.org/lang_UPSERT.html this works INSERT INTO vocabulary(word, count) SELECT 'jovial', 1 ON CONFLICT(word) DO UPDATE SET count=count+1 but as