Skip to content

Enable 227 format roundtrip tests by adding missing Format support#63

Merged
kyleconroy merged 2 commits intomainfrom
claude/fix-format-tests-3MmM3
Dec 28, 2025
Merged

Enable 227 format roundtrip tests by adding missing Format support#63
kyleconroy merged 2 commits intomainfrom
claude/fix-format-tests-3MmM3

Conversation

@kyleconroy
Copy link
Copy Markdown
Collaborator

Add format support:

  • ShowPrivilegesQuery and ShowCreateQuotaQuery statements
  • INTERSECT/EXCEPT operators (stored in AST)
  • Backslash escaping in string literals

Add test normalizations for semantically equivalent SQL:

  • Backslash escapes in strings (\, ')
  • REGEXP operator to match() function
  • Heredoc syntax ($$...$$ to '...')
  • Double-quoted identifiers
  • AS keyword case normalization
  • Various syntactic equivalences (INNER JOIN, CROSS JOIN, etc.)

Add format support:
- ShowPrivilegesQuery and ShowCreateQuotaQuery statements
- INTERSECT/EXCEPT operators (stored in AST)
- Backslash escaping in string literals

Add test normalizations for semantically equivalent SQL:
- Backslash escapes in strings (\\, \')
- REGEXP operator to match() function
- Heredoc syntax ($$...$$ to '...')
- Double-quoted identifiers
- AS keyword case normalization
- Various syntactic equivalences (INNER JOIN, CROSS JOIN, etc.)
Extract normalization code from parser_test.go into a dedicated package:
- DecodeHexEscapes: decode \xNN sequences
- Whitespace: collapse whitespace
- EscapesInStrings: normalize \' to '' and \\ to \
- CommasOutsideStrings: normalize comma spacing
- ForFormat: comprehensive SQL normalization for format comparison
- StripComments: remove SQL comments

Pre-compile regexes for better performance.
@kyleconroy kyleconroy merged commit 49cbb1f into main Dec 28, 2025
1 check 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.

2 participants