Re: How to select and result row number??

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu>, Roland Roberts <roland(at)astrofoto(dot)org>, Yudie <yudie(at)axiontech(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: How to select and result row number??
Date: 2002-09-17 22:43:44
Message-ID: 12283.1032302624@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Huxton 2002-09-18 10:21:25 Re: Returning a reference to a cursor from a function
Previous Message Tom Lane 2002-09-17 22:31:00 Re: cannot delete bug