Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Bug]: Silent failure when executing "WITH ... INSERT ... RETURNING" #3858

Copy link
Copy link
@josephvusich

Description

@josephvusich
Issue body actions

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|foo

Note 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.

empty table
nothing returned

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
wiz0u

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.