Skip to content

sqlite: appears to be confused by sqlc.arg or parentheses #1954

Closed
@mvdan

Description

@mvdan

Version

Other

What happened?

I have been using sqlc for over a year with sqlite, by using the mysql engine and holding it in the right way so that the generated code would be compatible with sqlite.

Now that sqlite is supported, I tried swapping the engines. I get syntax errors, which I reduced to the bits of code below.

This is with sqlc 1.16.0. I think the template is out of date: I could not pick this version, nor could I pick sqlite as the engine.[

Relevant log output

sqlc generate failed.

line 3:13 mismatched input '(' expecting {')', ','}
# package db
query.sql:1:1: mismatched input '(' expecting {')', ','}

Database schema

Not needed, really. The error happens when parsing the query.

SQL queries

-- name: GetPeople :many
SELECT ID FROM people
WHERE (LENGTH(sqlc.arg(name)) = 0);

Configuration

{
  "version": "1",
  "packages": [
    {
      "path": "db",
      "engine": "sqlite",
      "schema": "query.sql",
      "queries": "query.sql"
    }
  ]
}

Playground URL

https://play.sqlc.dev/p/a375863b4700d7104acad69d85e9c9b55f6611eb3a8214af946e490339b38e59

What operating system are you using?

Linux

What database engines are you using?

MySQL

What type of code are you generating?

Go

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