Skip to content

Merge reused MySQL named arguments in bundled Params classes #250

Description

@rayakame

sqlc's MySQL engine emits one parameter per occurrence of a reused named argument. Since #248, plain mode merges them - WHERE name = sqlc.arg(n) OR alias = sqlc.arg(n) generates a single n keyword argument bound at both positions.

Bundled mode (query_parameter_limit exceeded, or :copyfrom if MySQL ever gets one) does not: the Params class gets n and n_2 fields the caller must fill with the same value. The generated code binds them positionally correctly, so this is an API wart rather than a bug, and the combination is rare. Fixing it means marking repeated columns on the bundled class (mirroring QueryValue.Repeated) and skipping them in the class fields while keeping their binding slots in expandParams.

Metadata

Metadata

Assignees

No one assigned

    Labels

    goPull requests that update go code

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions