Re: GROUPING

Поиск
Список
Период
Сортировка
От David Fetter
Тема Re: GROUPING
Дата
Msg-id 20150521161511.GA17284@fetter.org
обсуждение исходный текст
Ответ на Re: GROUPING  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Ответы Re: GROUPING  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Re: GROUPING  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Список pgsql-hackers
On Thu, May 21, 2015 at 04:19:27PM +0100, Andrew Gierth wrote:
> >>>>> "Dean" == Dean Rasheed <dean.a.rasheed@gmail.com> writes:
> 
>  >> Consider that in both MSSQL 2014 and Oracle 12 the limit on the number
>  >> of arguments in a GROUPING() expression is ... 1.
> 
>  Dean> Actually Oracle haven't quite followed the standard. They have 2
>  Dean> separate functions: GROUPING() which only allows 1 parameter, and
>  Dean> GROUPING_ID() which allows multiple parameters, and returns a
>  Dean> bitmask like our GROUPING() function. However, their
>  Dean> GROUPING_ID() function seems to return an arbitrary precision
>  Dean> number and allows an arbitrary number of parameters (well, I
>  Dean> tested it up 70 to prove it wasn't a 64-bit number).
> 
> True. It can handle more than 128 bits, even - I gave up trying after that.
> 
> So. Options:
> 
> 1) change GROUPING() to return bigint and otherwise leave it as is.

Seems cheap and reasonable.  Making sure people know that GROUPING can
be called multiple times seems like another cheap and reasonable
measure.

> *) any other ideas?

How about a more sensible data structure as a PG-specific addon.
GROUPING_JSON() seems like just the thing.

Cheers,
David.
-- 
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Postgres and TLSv1.2
Следующее
От: Andrew Gierth
Дата:
Сообщение: Re: GROUPING