select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

FUNCTIONS / STRING FUNCTIONS AND OPERATORS

quote_nullable

Read PG 18 manual ↗

Returns the given string suitably quoted to be used as a string literal in an SQL statement string; or, if the argument is null, returns NULL.

Signatures & examples

quote_nullable ( text ) → text
Returns the given string suitably quoted to be used as a string literal in an SQL statement string; or, if the argument is null, returns NULL. Embedded single-quotes and backslashes are properly doubled. See also Example 41.1.
quote_nullable(NULL) → NULL
quote_nullable ( anyelement ) → text
Converts the given value to text and then quotes it as a literal; or, if the argument is null, returns NULL. Embedded single-quotes and backslashes are properly doubled.
quote_nullable(42.5) → '42.5'
Version history 8
  1. PG 16 → 17changed
  2. PG 13 → 14changed
  3. PG 12 → 13changed
  4. PG 11 → 12changed
  5. PG 10 → 11changed
  6. PG 9.6 → 10changed
  7. PG 9.5 → 9.6changed
  8. PG 9.2 → 9.3changed

Definition snapshot: 2026-09-14T13:14:25.684213+00:00@99e6866c · English manual source