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