Re: Debugging postmaster to fix possible bug in Postgres? Followup - Mailing list pgsql-sql

From Manfred Koizar
Subject Re: Debugging postmaster to fix possible bug in Postgres? Followup
Date
Msg-id f08o4vc1nd01ap1r4loq9m4g20rbsc384m@4ax.com
Whole thread Raw
In response to Re: Debugging postmaster to fix possible bug in Postgres? Followup  (Dmitry Tkach <dmitry@openratings.com>)
List pgsql-sql
On Thu, 13 Feb 2003 17:50:22 -0500, Dmitry Tkach
<dmitry@openratings.com> wrote:
>Then it looks like postgres behaviour is still not compliant, if I read it correctly, because
>
>select x from mytable order by y;
>
>should be invalid according to this, but works just fine in postres.

Yes, this is a Postgres extension to the standard.  Your query is
handled like
SELECT x, y FROM mytable ORDER BY y

with y being eliminated after the sort step.  This also explains why
the OP got the error message

ERROR:  Attribute t.y must be GROUPed or used in an aggregate function

because the implicitely rewritten form would look like
SELECT COUNT(*), y FROM t WHERE ... ORDER BY y

>P.S. I think, this is a great feature actually (missed it a lot in informix),
> so, I hope, you guys won't start discussing how to fix it :-)

AFAICT there's no need to worry.  Everyone agrees that this is a good
feature and it does not break standard SQL queries.

ServusManfred


pgsql-sql by date:

Previous
From: "Jeff Lu"
Date:
Subject: postmaster -i & establishes three connections why?
Next
From: Bruce Momjian
Date:
Subject: Re: Extending Datatype