Skip to content

Escape constant names in queries - #4525

Closed
snprajwal wants to merge 1 commit into
sqlc-dev:mainfrom
snprajwal:use-any
Closed

Escape constant names in queries#4525
snprajwal wants to merge 1 commit into
sqlc-dev:mainfrom
snprajwal:use-any

Conversation

@snprajwal

@snprajwal snprajwal commented Jul 26, 2026

Copy link
Copy Markdown

The any keyword was introduced in Go 1.18, and can be used in place of interface{}. This was not in the list of reserved keywords, leading to identifiers using this term in generated code.

Update the logic to escape constant names, and also add any to the list of reserved keywords.

This is a minimal rebased version of #3961, which I'm unable to reopen. It only contains the changes that fix invalid code generation.

The `any` keyword was introduced in Go 1.18, and can be used in place
of `interface{}`. This was not in the list of reserved keywords, leading
to identifiers using this term in generated code.

Update the logic to escape constant names, and also add `any` to the
list of reserved keywords.

Signed-off-by: Prajwal Nadig <prajwalnadig21@gmail.com>
@kyleconroy

Copy link
Copy Markdown
Collaborator

Please open an issue! I'm not currently accepting pull requests.

@kyleconroy kyleconroy closed this Jul 30, 2026
@snprajwal
snprajwal deleted the use-any branch July 30, 2026 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants