Bruce Momjian <pgman@candle.pha.pa.us> writes:
>> Say what? Given the ORDER BY in the subselect, it will.
> When you specify a table in FROM, there is no ordering to the table. Is
> it guaranteed that a subquery in FROM _does_ have an ordering.
If you write ORDER BY, we'll implement it.
> Does ANSI say it has an ordering?
ANSI forbids ORDER BY in sub-selects, so they don't have to address the
question.
> What if the subquery is involved in a join?
We are entitled to reorder its output for purposes of processing the
join, then. But that's entirely irrelevant to the example as given.
There is no reason to reorder the subselect output, and we won't.
regards, tom lane