# X_SQL_LITERAL_COPY

## Means

a module other than `packages/db/src/sql.ts` turns `'` into `''` itself

## Typical cause

three copies of the SQL string-literal escape shipped and **two were wrong the same way** — they doubled the quote and stopped. Doubling is only an escape while `standard_conforming_strings` is `on`; that GUC is settable per session, per database and per role, `SET` needs no privilege, and with it off a backslash escapes the character after it. Measured on 18.4: `'dd' ~ '^\d+$'` is FALSE with it on and **TRUE** with it off, and `.default('C:\logs')` stores `C:logs`. So a CHECK enforced a pattern nobody wrote and a column defaulted to a value nobody wrote, with no error at generation or at apply. Matched on the **transformation**, never a name: the three copies were called `literal`, `literalText` and an unnamed inline splice

## Fix

`bun run sql-literal-copies --json` — `import { literal } from '@ultimat3/db'` and take `.text` where a plain string is wanted; it emits `E'…'` only when the value carries a backslash, so every statement already on disk is byte-identical

[CLI and verify](/error-codes#cli-and-verify)
