Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 44B139FA4ED for ; Fri, 9 Feb 2007 12:35:31 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 37559-09 for ; Fri, 9 Feb 2007 12:35:30 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id 52AC79F9AFC for ; Fri, 9 Feb 2007 12:35:30 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 5571030DED; Fri, 9 Feb 2007 17:35:29 +0100 (MET) From: "Sabin Coanda" X-Newsgroups: pgsql.sql Subject: Re: alias not applied Date: Fri, 9 Feb 2007 18:35:35 +0200 Organization: Hub.Org Networking Services Lines: 55 Message-ID: References: <961.1171038340@sss.pgh.pa.us> X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original To: pgsql-sql@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200702/124 X-Sequence-Number: 27458 You are right. I use "PostgreSQL 8.1.0 on i686-pc-mingw32, compiled by GCC gcc.exe (GCC) 3.4.2 (mingw-special)" on Windows. But I just tried it on a newer version and it works well ( "PostgreSQL 8.1.4 on i686-redhat-linux-gnu, compiled by GCC gcc (GCC) 4.0.2 20051125 (Red Hat 4.0.2-8)" ). Thanks a lot, Sabin "Tom Lane" wrote in message news:961.1171038340@sss.pgh.pa.us... > "Sabin Coanda" writes: >> I have two queries: > >> 1. SELECT i AS "PK_ID", d AS "Deleted" FROM ( SELECT 52 AS i, true AS >> ) x >> ORDER BY i >> 2. SELECT i AS "PK_ID", d AS "Deleted" FROM ( SELECT 49 AS i, true AS d >> UNION SELECT 51 AS i, true AS d ) x ORDER BY i > >> The first returns the columns "PK_ID", "Deleted" >> The second returns the columns i, d. > > Works for me: > > regression=# SELECT i AS "PK_ID", d AS "Deleted" FROM ( SELECT 52 AS i, > true AS d ) x ORDER BY i; > PK_ID | Deleted > -------+--------- > 52 | t > (1 row) > > regression=# SELECT i AS "PK_ID", d AS "Deleted" FROM ( SELECT 49 AS i, > true AS d UNION SELECT 51 AS i, true AS d ) x ORDER BY i; > PK_ID | Deleted > -------+--------- > 49 | t > 51 | t > (2 rows) > > regression=# > > What PG version are you using, exactly? > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org >