Re: ORDER BY clause in aggregate doesn't work well with multi argument aggregates

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ORDER BY clause in aggregate doesn't work well with multi argument aggregates
Date: 2009-12-25 19:26:32
Message-ID: 8638.1261769192@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
> 2009/12/25 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>> No, because you could have more than one ORDER BY item.

> hmm - this isn't bullet-prof design :(

I notice that ORDER BY 'x' draws an error at the query level but not
within aggregates or window functions. I wonder if we should have the
"SQL99" ORDER BY code throw an error for a simple literal ORDER BY item.
There isn't any visible use for ordering by a constant, and this would
catch some possible misunderstandings. For instance, it would have
complained about Pavel's original example in this thread, and we could
word the error message to make it clear that the system thinks that's
an ORDER BY value not an aggregate argument.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-12-25 19:30:36 Re: info about patch: using parametrised query in psql
Previous Message Robert Haas 2009-12-25 19:17:56 Re: info about patch: using parametrised query in psql