Skip to content

INSERT from SELECT cannot be parsed with an ON CONFLICT clause #1987

Open

Description

@rtimush

Parsing the following SQL

INSERT INTO foo
  SELECT 1, 'data'
  ON CONFLICT DO NOTHING

fails with

Expected: end of statement, found: CONFLICT at Line: 3, Column: 6

both for Generic and PostgreSQL dialects.

However, at least in PostgreSQL it seems to be a valid construct, equivalent to

INSERT INTO foo
  (SELECT 1, 'data')
  ON CONFLICT DO NOTHING

(this one is parsed by sqlparser correctly).

The same query without the "ON CONFLICT" clause can be successfully parsed too.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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