Dmitry Tkach <dmitry@openratings.com> writes:
> 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.
Yup, it's an extension --- as indeed is pointed out at the bottom of our
SELECT reference page. But it's a well-defined extension, because every
row of the result does have a clearly associated value of y. Once you
throw in GROUP BY or aggregates, you can't order by values that aren't
constrained by the grouping.
regards, tom lane