Skip to content

MySQL copyfrom with query_parameter_limit: 0 generates invalid go code #3443

Closed
@Gardego5

Description

@Gardego5

Version

1.26.0

What happened?

When generating a copyfrom query in mysql and setting the query_parameter_limit to 0, sqlc incorrectly generates an invalid go file, calling the (e *mysqltsv.Encoder).AppendString(s string) function with an array of structs as the argument. This code does not compile.

Relevant log output

No response

Database schema

CREATE TABLE author (
  id   BIGINT UNSIGNED PRIMARY KEY,
  name text            NOT NULL
);

SQL queries

-- name: CreateAuthors :copyfrom
INSERT INTO author
	(name)
VALUES (?);

Configuration

version: "2"
sql:
  - engine: "mysql"
    schema: "migrations/sqlc"
    queries: "queries"
    gen:
      go:
        package: "db"
        sql_package: database/sql
        sql_driver: github.com/go-sql-driver/mysql

Playground URL

https://play.sqlc.dev/p/34328b7faed42fedb392c42cbe3a6851ebce76e304fcf091fe0f81368d52273c

What operating system are you using?

macOS

What database engines are you using?

MySQL

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

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions