Skip to content

fix: avoid panic in token.QuoteSQLIdent("") - #407

Open
apstndb wants to merge 2 commits into
cloudspannerecosystem:mainfrom
apstndb:fix/quote-sql-ident-empty
Open

fix: avoid panic in token.QuoteSQLIdent("")#407
apstndb wants to merge 2 commits into
cloudspannerecosystem:mainfrom
apstndb:fix/quote-sql-ident-empty

Conversation

@apstndb

@apstndb apstndb commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Make QuoteSQLIdent("") return two backticks instead of panicking.
  • Add regression coverage for the empty input.

Related Issues

needQuoteSQLIdent read s[0] without a length check, so QuoteSQLIdent("")
panicked with an index-out-of-range. Any programmatically built AST with
an empty Ident therefore crashed on SQL(). Guard the empty string: an
empty identifier cannot be written unquoted, so it is backquoted (``).
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.

Avoid a panic in QuoteSQLIdent for empty input

1 participant