pg_quote — Escape and quote a string for use in an SQL string constant
pg_quote string
pg_quote
returns its argument in single quotes, with added
characters which makes it safe for use as an SQL string constant.
It returns the string in single quotes, with all internal single
quote marks and backslash characters doubled.
For example, pg_quote {a'b\c}
returns
the string 'a''b\\c'
.
See also pg_escape_string, which returns the same thing but without the single quotes. The reason both are present is to attempt to be compatible in the face of changes to another implementation of this interface.
This command was added in pgtclng-1.5.1 and in pgintcl-2.1.0.
This command uses or emulates the PostgreSQL
libpq
function PQescapeString
.