Re: Syntax bug? Group by?

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Mark Woodward <pgsql(at)mohawksoft(dot)com>
Cc: Markus Schaber <schabi(at)logix-tt(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Syntax bug? Group by?
Date: 2006-10-17 18:48:09
Message-ID: 45352569.8010708@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Mark Woodward wrote:
>> Hi, Mark,
>>
>> Mark Woodward wrote:
>>
>>> Shouldn't this work?
>>>
>>> select ycis_id, min(tindex), avg(tindex) from y where ycis_id = 15;
>>>
>>> ERROR: column "y.ycis_id" must appear in the GROUP BY clause or be used
>>> in an aggregate function
>>>
>>> If I am asking for a specific column value, should I, technically
>>> speaking, need to group by that column?
>>>
>> Try:
>>
>> SELECT 15 as ycis_id, min(tindex), avt(tindex) from y where ycis_id = 15;
>>
>>
>>
> This isn't a "SQL" question!!! This is a question of whether or not
> PostgreSQL is correct in requiring a "group by" in the query. I assert
> that since it is unabiguous as to what "ycis_id" should be, PostgreSQL
> should not require a grouping.
>
>

Of course it's an SQL question. How can you ask about the correctness of
a piece of text which purports to be SQL and then say it isn't an SQL
question?

If you can point to a place in the spec or our docs that sanctions the
usage you expect, then please do so, Until then I (and I suspect
everyone else) will persist in saying it's not a bug.

cheers

andrew

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Shane Ambler 2006-10-17 18:58:48 Re: Syntax bug? Group by?
Previous Message Mark Woodward 2006-10-17 18:46:54 Re: Syntax bug? Group by?