Re: [HACKERS] ordered aggregates using WITHIN GROUP (was Re: can somebody execute this query on Oracle 11.2g and send result?)

2010-01-31 Thread Hitoshi Harada
2010/2/1 Tom Lane : > Hitoshi Harada writes: >> In other words, the queries can be the same: > >> SELECT array_agg(val ORDER BY sk) FROM ... >> SELECT array_agg(val) WITHIN GROUP (ORDER BY sk) FROM ... > > One more time: THOSE DON'T MEAN THE SAME THING.  If we ever get > around to implementing the

Re: [HACKERS] ordered aggregates using WITHIN GROUP (was Re: can somebody execute this query on Oracle 11.2g and send result?)

2010-01-31 Thread Tom Lane
Hitoshi Harada writes: > As far as I know is used to do "what-if" > analysis. rank(val1) within group (order by sk1) chooses the rank > value so that val1 is equivalent to or just greater than sk1 when you > calculate rank() over (partition by group order by sk1) within the > group. Hmm. I foun

Re: [HACKERS] ordered aggregates using WITHIN GROUP (was Re: can somebody execute this query on Oracle 11.2g and send result?)

2010-01-30 Thread Hitoshi Harada
2010/1/30 Tom Lane : > "Jonah H. Harris" writes: >>> http://download.oracle.com/docs/cd/E11882_01/server.112/e10592/functions087.htm >>> >>> Defines: >>> >>> *LISTAGG* (measure_expr [, 'delimiter_expr']) >>> *WITHIN GROUP* (order_by_clause) [*OVER* query_partition_clause] > > Hmph.  I don't know w

Re: [HACKERS] ordered aggregates using WITHIN GROUP (was Re: can somebody execute this query on Oracle 11.2g and send result?)

2010-01-29 Thread Tom Lane
"Jonah H. Harris" writes: >> http://download.oracle.com/docs/cd/E11882_01/server.112/e10592/functions087.htm >> >> Defines: >> >> *LISTAGG* (measure_expr [, 'delimiter_expr']) >> *WITHIN GROUP* (order_by_clause) [*OVER* query_partition_clause] Hmph. I don't know what would possess them to mode

Re: [HACKERS] ordered aggregates using WITHIN GROUP (was Re: can somebody execute this query on Oracle 11.2g and send result?)

2010-01-29 Thread Jonah H. Harris
On Fri, Jan 29, 2010 at 12:09 PM, Jonah H. Harris wrote: > On Fri, Jan 29, 2010 at 11:57 AM, Tom Lane wrote: > >> I find it doubtful that it's actually necessary in Oracle's version >> of listagg ... >> > > Eh? > > > http://download.oracle.com/docs/cd/E11882_01/server.112/e10592/functions087.htm

Re: [HACKERS] ordered aggregates using WITHIN GROUP (was Re: can somebody execute this query on Oracle 11.2g and send result?)

2010-01-29 Thread Jonah H. Harris
On Fri, Jan 29, 2010 at 11:57 AM, Tom Lane wrote: > I find it doubtful that it's actually necessary in Oracle's version > of listagg ... > Eh? http://download.oracle.com/docs/cd/E11882_01/server.112/e10592/functions087.htm Defines: *LISTAGG* (measure_expr [, 'delimiter_expr']) *WITHIN GROUP

Re: [HACKERS] ordered aggregates using WITHIN GROUP (was Re: can somebody execute this query on Oracle 11.2g and send result?)

2010-01-29 Thread Tom Lane
Alvaro Herrera writes: > So that's how Oracle supports ordered aggregates? Interesting -- we > just got that capability but using a different syntax. Hmm, the > SQL:200x draft also has which seems the > standard way to do the ORDER BY stuff for aggregates ... Should we > change the syntax? No

[HACKERS] ordered aggregates using WITHIN GROUP (was Re: can somebody execute this query on Oracle 11.2g and send result?)

2010-01-29 Thread Alvaro Herrera
Jonah H. Harris escribió: > The syntax is listagg(expression [, delimiter]) WITHIN GROUP (order by > clause) [OVER partition clause] > If a delimiter is defined, it must be a constant. > > Query: SELECT listagg(a, ',') WITHIN GROUP (ORDER BY a) FROM foo; > Result: aaa,bbb,ccc So that's how Oracl