Skip to content

query_parameter_limit breaks batchexec queries #3185

@SoMuchForSubtlety

Description

@SoMuchForSubtlety

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions