Skip to content

fix(spanner): reject numeric and mid-identifier dollar-quoted string tags - #15071

Open
sakthivelmanii wants to merge 1 commit into
mainfrom
fix-spanner-pg-dollar-quoted-tags
Open

sakthivelmanii wants to merge 1 commit into
mainfrom
fix-spanner-pg-dollar-quoted-tags

Conversation

@sakthivelmanii

Copy link
Copy Markdown
Contributor

Align PostgreSQL-dialect dollar-quoted string tag recognition in the Spanner client statement parser with PostgreSQL lexical rules:

  • Reject non-empty dollar-quote tags that begin with a digit (such as $1$ or $10$) so positional parameters adjacent to $ are not misinterpreted as string literal delimiters.
  • Ignore $ characters immediately preceded by an unquoted identifier character (such as col$tag$a or col$$) so valid PostgreSQL identifiers containing $ do not open false dollar-quoted string literals and mask subsequent query parameters, comments, or RETURNING clauses.

…tags

Align PostgreSQL-dialect dollar-quoted string tag recognition in the Spanner client statement parser with PostgreSQL lexical rules:

- Reject non-empty dollar-quote tags that begin with a digit (such as `$1$` or `$10$`) so positional parameters adjacent to `$` are not misinterpreted as string literal delimiters.
- Ignore `$` characters immediately preceded by an unquoted identifier character (such as `col$tag$a` or `col$$`) so valid PostgreSQL identifiers containing `$` do not open false dollar-quoted string literals and mask subsequent query parameters, comments, or `RETURNING` clauses.
@sakthivelmanii
sakthivelmanii requested review from a team as code owners November 18, 2026 21:44

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the PostgreSQL dollar-quoted string parsing logic in AbstractStatementParser to prevent positional parameters (such as $1) and mid-identifier dollar signs from being incorrectly parsed as dollar-quote tags. It introduces stricter validation using isValidIdentifierFirstChar and ensures a dollar-quoted literal cannot open immediately after an identifier character. Comprehensive unit tests have been added to StatementParserTest to validate these changes. No review comments were provided, so there is no additional feedback.

This branch has not been deployed

No deployments
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.

1 participant