Re: GROUPING - Mailing list pgsql-hackers

From Tom Lane
Subject Re: GROUPING
Date
Msg-id 27612.1432222959@sss.pgh.pa.us
Whole thread Raw
In response to Re: GROUPING  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
List pgsql-hackers
Andrew Gierth <andrew@tao11.riddles.org.uk> writes:
> So. Options:

> 1) change GROUPING() to return bigint and otherwise leave it as is.

> 2) change GROUPING() to return numeric.

> 3) change GROUPING() so that the result type varies with the number of
> args. I don't see anything in the spec that actually forbids this - it
> just says the return type is implementation-defined exact numeric.

I'd go with (1) --- it's cheap and doesn't lose any capability.  If you
do (2), you'd lose useful operations like &, unless you cast back to int
which pretty much defeats the purpose.  And (3) is just weird and will
confuse people, especially since numeric and int don't have identical
sets of operations.

Or we could just leave things alone.  But (1) seems like pretty cheap
insurance.


> A) in addition to any of the above, implement GROUPING_ID() as a simple
> alias for GROUPING().

I see no reason to do that.  We don't need to copy Oracle-isms; the
language is already complicated enough.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: Redesigning checkpoint_segments
Next
From: Robert Haas
Date:
Subject: Re: Minor improvements to alter_foreign_table.sgml