sqlc icon indicating copy to clipboard operation
sqlc copied to clipboard

`query_parameter_limit` breaks `batchexec` queries

Open SoMuchForSubtlety opened this issue 1 year ago • 0 comments

Version

1.25.0

What happened?

If the number of parameters for a batchexec is ≤ query_parameter_limit, the struct for the parameters does not get generated.

The generated function still tries to use the missing struct, and thus does not compile.

Relevant log output

No response

Database schema

CREATE TABLE authors (
  name text      NOT NULL,
  bio  text
);

SQL queries

-- name: CreateAuthors :batchexec
INSERT INTO authors (
  name, bio
) VALUES (
  $1, $2
);

Configuration

{
  "version": "2",
  "sql": [{
    "schema": "schema.sql",
    "queries": "query.sql",
    "engine": "postgresql",
    "gen": {
      "go": {
        "out": "db",
        "sql_package": "pgx/v5",
        "query_parameter_limit": 2
      }
    }
  }]
}

Playground URL

https://play.sqlc.dev/p/2741cf608de5f3ea978a6feef8e2cf094a3d3dad9c8b0230e4a0e3039132b16b

What operating system are you using?

Linux

What database engines are you using?

PostgreSQL

What type of code are you generating?

Go

SoMuchForSubtlety avatar Feb 06 '24 16:02 SoMuchForSubtlety