Skip to content

Render prefix ~ operator with a space - #2533

Open
LucaCappelletti94 wants to merge 1 commit into
mainfrom
postgres-pgbitnot-display-space
Open

LucaCappelletti94 wants to merge 1 commit into
mainfrom
postgres-pgbitnot-display-space

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Contributor

Fuzz round-trip found SELECT ~ -1 rendering as SELECT ~-1, which PostgreSQL retokenizes as the single ~- custom operator and fails to re-parse. SELECT ~ ~1 renders SELECT ~~1 and fails in every dialect, ~ @2 renders ~@2 and ~ #x renders ~# x in PostgreSQL.

Expr::UnaryOp display concatenates operator and operand in its final arm. BitwiseNot joins the spaced arm beside Not and Hash, the same remedy #2531 applies to @. Canonical output for SELECT ~expr becomes SELECT ~ expr, pinned with one_statement_parses_to in parse_generic_unary_ops.

@LucaCappelletti94
LucaCappelletti94 marked this pull request as ready for review September 19, 2026 20:37
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