Skip to content

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

Closed
@SoMuchForSubtlety

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

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