Skip to content

unicode fix#7904

Closed
stwala wants to merge 1 commit into
tobymao:mainfrom
stwala:main
Closed

unicode fix#7904
stwala wants to merge 1 commit into
tobymao:mainfrom
stwala:main

Conversation

@stwala

@stwala stwala commented Jul 19, 2026

Copy link
Copy Markdown

Fix Postgres Unicode escape string literals (U&'...') being corrupted during parsing and regeneration. Today U&'\FE01' tokenizes as the identifier U followed by the & operator, so round-tripping through sqlglot.transpile(sql, read="postgres", write="postgres") turns it into U & '\FE01', which changes the SQL on round-trip. The Postgres tokenizer should recognize U&'...' (case-insensitive U, immediately followed by &, no space) as a single unicode-escape string literal. Escape sequences inside use a leading backslash followed by either a 4-digit or 6-digit hex code point (\FE01, +01F600). An optional UESCAPE '' clause after the closing quote can override the default escape character; doubling the escape character inside the literal represents that character itself. Parsing and regenerating one of these literals must preserve the U&'...' form (and its UESCAPE clause, if present) rather than splitting it into separate tokens

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