Generic SQL formatters mishandle PostgreSQL-specific syntax, and the output shows it
Pasting a Postgres query into a general-purpose online SQL formatter usually looks fine, but breaks on constructs like :: casts, JSON operators, and dollar-quoted function bodies. The author explains that these tools tokenise text rather than understand SQL, while PostgreSQL bends token rules more than other dialects. Pinning the formatter to the PostgreSQL dialect avoids this guessing, and identifier case must be preserved because unquoted names fold to lowercase. Tools like pgFormatter parse plpgsql properly and suit repository or CI use, while pgAdmin and psql offer little in the way of formatting. The author's browser-based, dialect-pinned formatter runs locally so queries containing real data are not transmitted, though it cannot verify schema or query plans.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in