Received: from candle.pha.pa.us (candle.navpoint.com [162.33.245.46]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f5PF6da69518 for ; Mon, 25 Jun 2001 11:06:39 -0400 (EDT) (envelope-from pgman@candle.pha.pa.us) Received: (from pgman@localhost) by candle.pha.pa.us (8.10.1/8.10.1) id f5PF6J905523; Mon, 25 Jun 2001 11:06:19 -0400 (EDT) From: Bruce Momjian Message-Id: <200106251506.f5PF6J905523@candle.pha.pa.us> Subject: Re: doc question about column name alias In-Reply-To: <3B374CF6.C1AB82F0@zhengmai.com.cn> "from Weiping He at Jun 25, 2001 10:38:46 pm" To: Weiping He Date: Mon, 25 Jun 2001 11:06:19 -0400 (EDT) CC: pgsql-docs@postgresql.org X-Mailer: ELM [version 2.4ME+ PL90 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Archive-Number: 200106/41 X-Sequence-Number: 839 > Hi, > I'm translating 7.1.2's doc to Chinese, and got one question while > doing these, > in queries.sgml line 795: > > SELECT a AS b FROM table1 ORDER BY a; > > I think it should be: > > SELECT a AS b FROM table1 ORDER BY b; > > but from the context:" References to column names in the FROM clause > that are renamed in the select list are also allowed:" > it seems the original is correct. Am I misunderstood? How the SQL > standard saids? > Thanks. Both work: test=> select relname as x from pg_class order by relname; and test=> select relname as x from pg_class order by x; I am not sure which is more standards-compliant. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026