↑↓ select ↵ open ⌫ change scope Open full search

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

Functions / Aggregate Functions

Returns a bit mask indicating which GROUP BY expressions are not included in the current grouping set.

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

Signatures & examples

GROUPING ( group_by_expression(s) ) → integer
Returns a bit mask indicating which GROUP BY expressions are not included in the current grouping set. Bits are assigned with the rightmost argument corresponding to the least-significant bit; each bit is 0 if the corresponding expression is included in the grouping criteria of the grouping set generating the current result row, and 1 if it is not included.
Version history 2
  1. 12 → 13 changed
  2. 9.4 → 9.5 added

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