↑↓ select ↵ open ⌫ change scope Open full search

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

Functions / Conditional Expressions

The GREATEST and LEAST functions select the largest or smallest value from a list of any number of expressions.

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

Signatures & examples

LEAST(value [, ...])
The GREATEST and LEAST functions select the largest or smallest value from a list of any number of expressions. The expressions must all be convertible to a common data type, which will be the type of the result (see Section 10.5 for details).
Version history 3
  1. 15 → 16 changed
  2. 12 → 13 changed
  3. 8.0 → 8.1 added

Definition snapshot: b7bd9cda · English manual source