Re: Bug Fix: COLLATE with multiple ORDER BYs in aggregates

From: David Fetter <david(at)fetter(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andres Freund <andres(at)2ndquadrant(dot)com>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Bug Fix: COLLATE with multiple ORDER BYs in aggregates
Date: 2013-04-26 00:12:52
Message-ID: 20130426001252.GC12695@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Apr 25, 2013 at 06:04:10PM -0400, Tom Lane wrote:
> Andres Freund <andres(at)2ndquadrant(dot)com> writes:
> > On 2013-04-25 13:42:32 -0400, Tom Lane wrote:
> >> The argument for it seems to be that
> >> array_agg(a COLLATE "C" ORDER BY b COLLATE "POSIX")
> >> should not throw an error, but why not?
>
> > Uh. Why should it? SELECT foo COLLATE "C" FROM ... ORDER BY bar COLLATE
> > "POSIX" doesn't throw one either?
>
> After thinking about it a bit more, this case *should* throw an error:
>
> string_agg(a COLLATE "C", b COLLATE "POSIX")
>
> but these should not:
>
> array_agg(a COLLATE "C" ORDER BY b COLLATE "POSIX")
>
> array_agg(a ORDER BY b COLLATE "C", c COLLATE "POSIX")
>
> that is, the ORDER BY expression(s) ought to be considered independently
> rather than as part of the agg's argument list.
>
> It looks like the proposed patch gets this right, but the proposed
> test cases really fail to illuminate the problem IMO.
>
> regards, tom lane

Am I understanding correctly that you want the code left alone and the
test case expanded as above?

Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Joshua D. Drake 2013-04-26 00:22:26 Re: 9.3 release notes suggestions
Previous Message Daniel Farina 2013-04-25 23:48:48 Re: 9.3 release notes suggestions