Skip site navigation (1) Skip section navigation (2)

Re: doc question about column name alias

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Weiping He <laser(at)zhengmai(dot)com(dot)cn>
Cc: pgsql-docs(at)postgresql(dot)org
Subject: Re: doc question about column name alias
Date: 2001-06-25 15:06:19
Message-ID: 200106251506.f5PF6J905523@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-docs
> 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(at)candle(dot)pha(dot)pa(dot)us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

In response to

pgsql-docs by date

Next:From: Tom LaneDate: 2001-06-25 15:35:54
Subject: Re: doc question about column name alias
Previous:From: Weiping HeDate: 2001-06-25 14:38:46
Subject: doc question about column name alias

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group