Skip to content

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

Merged
makenowjust merged 2 commits into
cloudspannerecosystem:mainfrom
apstndb:fix/quote-sql-ident-empty
Sep 2, 2026
Merged

fix: avoid panic in token.QuoteSQLIdent("")#407
makenowjust merged 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 (``).

@makenowjust makenowjust left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@makenowjust
makenowjust merged commit e6a536f into cloudspannerecosystem:main Sep 2, 2026
7 checks passed
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

2 participants