-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
What did you do?
INSERT fails silently (no error) when combining WITH and RETURNING clauses, but only in DB Browser. The same expression succeeds in multiple versions of the sqlite3 CLI.
Below is a minimal reproduction case I put together for DB Browser 3.13.1 (the latest release as of today.)
-- Ran with DB Browser for SQLite Version 3.13.1, Last commit hash when built: 5d84f53
CREATE TABLE demo (
id INTEGER PRIMARY KEY,
value TEXT NOT NULL
);
-- Note that this is a contrived example intended to showcase the issue.
WITH cte(value) AS (
VALUES('foo')
)
INSERT INTO demo (id, value) VALUES(1, (SELECT value FROM cte))
RETURNING id;What did you expect to see?
I expected to see a new row appear in demo, and the new id returned. For reference, this is what I see from the CLI:
$ sqlite3 test.db "CREATE TABLE demo (
id INTEGER PRIMARY KEY,
value TEXT NOT NULL
);
WITH cte(value) AS (
VALUES('foo')
)
INSERT INTO demo (id, value) VALUES(1, (SELECT value FROM cte))
RETURNING id;
SELECT * FROM demo;"
1
1|fooNote that the statement returns an id of 1 as expected, and a new row is successfully inserted. I tested this using sqlite3 versions 3.43.2 and 3.48.0. Both work as expected.
What did you see instead?
No row is inserted into demo. No value is returned (screenshots below.)
I believe this issue is similar to #2854.
Note that if either WITH or RETURNING are removed, the remaining expression behaves as expected. This bug only appears when INSERT has both clauses present.
DB4S Version
3.13.1
What OS are you seeing the problem on?
MacOS
OS version
MacOS Sequoia 15.2 (24C101)
Relevant log output
Prevention against duplicate issues
- I have searched for similar issues

