Skip to main content

Module sql

Module sql 

Source
Expand description

SQL minifier (Postgres-flavored, the canonical dialect per spec §4.5).

Distinguishing features:

  • Line comments are --, not //.
  • Block comments /* … */ nest in Postgres.
  • String literals are single-quoted with '' doubled-escape; there are no backslash escapes in standard SQL.
  • Identifier quoting "…" with "" doubled-escape (Postgres).
  • Dollar-quoted strings $tag$ … $tag$ (Postgres) — verbatim, with arbitrary user-defined tag (which may be empty: $$ … $$).

Strategy: aggressive (Strategy A). SQL statements are explicitly ;-terminated, so newlines can be stripped freely.

Functions§

minify