pg_escape_string — Escape a string for use in an SQL string constant
pg_escape_string string
pg_escape_string returns its argument with added
characters which makes it safe for use in single-quoted SQL string
constants. Mostly it returns the string with all single quote marks
and backslash characters doubled.
For example, pg_escape_string {a'b\c} returns
the string a''b\\c.
See also pg_quote.
This command uses or emulates the PostgreSQL
libpq
function PQescapeString.
The original Pgtcl implementation has a command with the same name but a different return value.