Skip to content

sqlc.slice() breaks SQLite queries that contain other parameters. #2452

Open
@SoMuchForSubtlety

Description

@SoMuchForSubtlety

Version

1.18.0

What happened?

sqlc generates queries using numbered parameters, but if a sqlc.slice comes before other parameters, the numbers will no longer match.

Relevant log output

No response

Database schema

CREATE TABLE authors (
  id   integer PRIMARY KEY,
  name text      NOT NULL,
  age  ingeger
);

SQL queries

-- name: SomeQuery :many
select * from authors
where name in (sqlc.slice(names)) 
  and age = $age;

Configuration

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

Playground URL

https://play.sqlc.dev/p/009df3b554022fd08ed62f1940e1ec63303e165e7e95182eb702d4b9351a56c4

What operating system are you using?

Linux

What database engines are you using?

SQLite

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