Skip to content

[BUG] SQLite: INSERT OR IGNORE / ABORT / FAIL / ROLLBACK and UPDATE OR ... do not parse #2852

Open

Description

@ItsDeadlyProgrammer

SQLite accepts a conflict resolution algorithm after INSERT OR and UPDATE OR: ABORT, FAIL, IGNORE, REPLACE and ROLLBACK (lang_insert, lang_update, lang_conflict). Only INSERT OR REPLACE parses.

JSqlParser: current master (90ac3a7).

Statement Result
INSERT OR REPLACE INTO t VALUES (1) parses
INSERT OR IGNORE INTO t VALUES (1) Encountered: <K_INSERT> / "INSERT"
INSERT OR ABORT INTO t VALUES (1) same
INSERT OR FAIL INTO t VALUES (1) same
INSERT OR ROLLBACK INTO t VALUES (1) same
UPDATE OR IGNORE t SET a = 1 Encountered: <K_UPDATE> / "UPDATE"
UPDATE OR REPLACE t SET a = 1 same

INSERT OR IGNORE is the usual SQLite form of "insert if it does not exist yet", so it is common in application code. The grammar handles only <K_INSERT> <K_OR> <K_REPLACE> as an Upsert (UpsertType.INSERT_OR_REPLACE).

Related in the same dialect: CREATE TABLE t (a INT) WITHOUT ROWID fails with Expected OIDS but found ROWID, and ... STRICT fails with Encountered: <K_STRICT>.

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

      ⌂ Proxy