Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id AA205475C5F for ; Tue, 17 Sep 2002 18:47:44 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 228D4475BF9 for ; Tue, 17 Sep 2002 18:47:44 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.5/8.12.5) with ESMTP id g8HMhi5D012284; Tue, 17 Sep 2002 18:43:44 -0400 (EDT) To: Bruce Momjian Cc: "Ross J. Reedstrom" , Roland Roberts , Yudie , pgsql-sql@postgresql.org Subject: Re: How to select and result row number?? In-reply-to: <200209172221.g8HMLH227467@candle.pha.pa.us> References: <200209172221.g8HMLH227467@candle.pha.pa.us> Comments: In-reply-to Bruce Momjian message dated "Tue, 17 Sep 2002 18:21:17 -0400" Date: Tue, 17 Sep 2002 18:43:44 -0400 Message-ID: <12283.1032302624@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200209/201 X-Sequence-Number: 9478 Bruce Momjian 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