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 umi.tan...@gmail.com writes: As far as I know hypothetical set function 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

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 t...@sss.pgh.pa.us: Hitoshi Harada umi.tan...@gmail.com 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

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 t...@sss.pgh.pa.us: Jonah H. Harris jonah.har...@gmail.com 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]

[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 Oracle

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 alvhe...@commandprompt.com 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 within group specification which seems the standard way to do the ORDER BY stuff for

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 t...@sss.pgh.pa.us 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'])

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 jonah.har...@gmail.comwrote: On Fri, Jan 29, 2010 at 11:57 AM, Tom Lane t...@sss.pgh.pa.us wrote: I find it doubtful that it's actually necessary in Oracle's version of listagg ... Eh?

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 jonah.har...@gmail.com 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