↑↓ select ↵ open ⌫ change scope Open full search

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

Functions / Conditional Expressions

The NULLIF function returns a null value if value1 equals value2; otherwise it returns value1.

Reading PG 18current·documented in 27 of 27 versions, 7.1 to 20

Signatures & examples

NULLIF(value1, value2)
The NULLIF function returns a null value if value1 equals value2; otherwise it returns value1. This can be used to perform the inverse operation of the COALESCE example given above:
Version history 4
  1. 12 → 13 changed
  2. 8.3 → 8.4 changed
  3. 8.0 → 8.1 changed
  4. 7.2 → 7.3 changed

Definition snapshot: b7bd9cda · English manual source