Skip to content

Merge reused MySQL named arguments in bundled Params classes #250

Closed

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.

Activity

  1. added
    goPull requests that update go code
    on Aug 13, 2026
  2. rayakame commented on Aug 15, 2026

    @rayakame
    OwnerAuthor

    Fixed in #248: bundledParams now merges reused named arguments the same way plainParams does, with the repeated occurrences keeping their binding slots.

  3. added a commit that references this issue on Aug 15, 2026
    54d6d24
  4. added a commit that references this issue on Aug 15, 2026
    e089b55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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