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.

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. PG 12 → 13changed
  2. PG 9.4 → 9.5added

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