Skip to content

sqlc.slice() generates broken code when emit_prepared_queries is enabled #2430

Description

@SoMuchForSubtlety

Version

1.19.0

What happened?

pkg/db/my_table.sql.go:95:35: not enough arguments in call to q.query
        have (context.Context, string, []interface{})
        want (context.Context, *sql.Stmt, string, ...interface{})

Relevant log output

No response

Database schema

-- Example queries for sqlc
CREATE TABLE authors (
  name text      NOT NULL,
  bio  text
);

SQL queries

-- name: GetAuthorsBroken :many
SELECT * FROM authors
WHERE name in (sqlc.slice(names));

Configuration

version: 2
sql:
  - engine: "sqlite"
    schema: "pkg/db/migrations"
    queries: "pkg/db/queries"
    gen:
      go:
        emit_prepared_queries: true
        emit_db_tags: true
        package: "db"

Playground URL

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

What operating system are you using?

Linux

What database engines are you using?

SQLite

What type of code are you generating?

Go

Activity

  1. added
    bugSomething isn't working
    triageNew issues that hasn't been reviewed
    on Jul 11, 2023
  2. added 2 commits that reference this issue on Jul 11, 2023
    8ec7acb
    ca9be96
  3. added a commit that references this issue on Jul 26, 2023
    3a67691
  4. added a commit that references this issue on Oct 13, 2025
    a673247
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

    bugSomething isn't workingtriageNew issues that hasn't been reviewed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions