Skip to content

INSERT OR IGNORE INTO doesn't work, sqlite3 #1277

Description

@mattiasgrenfeldt

Version

1.10.0

What happened?

I wanted to make a INSERT OR IGNORE INTO query against a sqlite3 db (https://sqlite.org/lang_insert.html). When running sqlc it thinks that it is a syntax error.

Relevant log output

# package db
sql/queries.sql:1:1: syntax error at or near "OR"

Database schema

CREATE TABLE IF NOT EXISTS items (
    id INTEGER PRIMARY KEY,
    name varchar(256) UNIQUE NOT NULL,
    unit varchar(256) NOT NULL
);

SQL queries

-- name: CreateItem :exec
INSERT OR IGNORE INTO items (name, unit) VALUES ($1, $2);

Configuration

version: "1"
packages:
  - path: "projectname/db"
    name: "db"
    schema: "sql/schema.sql"
    queries: "sql/queries.sql"

Playground URL

https://play.sqlc.dev/p/89430560ded19826e9822bb05d9107919f92760e28980b5bf461237a34dbc0ca

What operating system are you using?

Linux

What database engines are you using?

No response

What type of code are you generating?

Go

Activity

  1. added
    bugSomething isn't working
    triageNew issues that hasn't been reviewed
    on Nov 8, 2021
  2. StevenACoffman commented on Nov 9, 2021

    @StevenACoffman
    Contributor

    current experimental sqlite3 support is ... not great. we need a better parser library. Please see #161

  3. hakobera commented on Jun 26, 2022

    @hakobera
    Contributor

    @mattiasgrenfeldt This issue should be resolved by #1687

  4. abhijit-hota commented on Nov 5, 2022

    @abhijit-hota

    @kyleconroy Shouldn't we close this issue?

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions