Skip to content

Insert and InsertLegacy Incompatibility #1063

Closed
@johnedquinn

Description

@johnedquinn

Original Comment

@dlurton -- regarding the query for reproducing the issue. It seems that this actually has to do with the mixing-and-matching of the "legacy" INSERT command with the "current" ON CONFLICT clause. The grammar says:

insertCommand
    : INSERT INTO pathSimple VALUE value=expr ( AT pos=expr )? onConflictClause?  # InsertLegacy
    | INSERT INTO symbolPrimitive asIdent? value=expr onConflictClause?           # Insert
    ;

onConflictClause
    : ON CONFLICT WHERE expr DO NOTHING                                           # OnConflictLegacy
    | ON CONFLICT conflictTarget? conflictAction                                  # OnConflict
    ;

While the grammar says we can mix-and-match the "legacy" and "current" commands/clauses, we actually don't allow it in the visitor. Ideally, this should be expressed more explicitly within our grammar. I spoke to @am357 , and it seems that we are maintaining the "legacy" insert and "legacy" on-conflict clauses for backward-compatibility.

Anyways, this issue is present in main, and I'll leave it out of the scope of this PR.

Originally posted by @johnedquinn in #1061 (comment)

Further Clarification

The ANTLR grammar currently supports mixing and matching of the insert, insertLegacy, onConflict, and onConflictLegacy rules. We should only be supporting:

  • insert with onConflict
  • insertLegacy with onConflictLegacy

Proposed Solution

  • We need to modify this in the grammar
  • We potentially need to update the AST, but I haven't looked into this very much.

Definition of Done

  • The inability to parse the mix-and-match.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions