pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
alias not applied
4+ messages / 3 participants
[nested] [flat]

* alias not applied
@ 2007-02-09 16:04  Sabin Coanda <sabin.coanda@deuromedia.ro>
  0 siblings, 2 replies; 4+ messages in thread

From: Sabin Coanda @ 2007-02-09 16:04 UTC (permalink / raw)
  To: pgsql-sql

Hi all,

I have two queries:

1. SELECT i AS "PK_ID", d AS "Deleted" FROM ( SELECT 52 AS i, true AS d  ) 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.

Why ?

TIA,
Sabin 





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: alias not applied
@ 2007-02-09 16:19  Frank Bax <fbax@sympatico.ca>
  parent: Sabin Coanda <sabin.coanda@deuromedia.ro>
  1 sibling, 0 replies; 4+ messages in thread

From: Frank Bax @ 2007-02-09 16:19 UTC (permalink / raw)
  To: pgsql-sql

At 11:04 AM 2/9/07, Sabin Coanda wrote:
>I have two queries:
>
>1. SELECT i AS "PK_ID", d AS "Deleted" FROM ( SELECT 52 AS i, true AS d  ) 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.
>
>Why ?


perhaps you are running an old version - both queries produce the same 
column names on my 8.2.1 system.




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: alias not applied
@ 2007-02-09 16:25  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Sabin Coanda <sabin.coanda@deuromedia.ro>
  1 sibling, 1 reply; 4+ messages in thread

From: Tom Lane @ 2007-02-09 16:25 UTC (permalink / raw)
  To: Sabin Coanda <sabin.coanda@deuromedia.ro>; +Cc: pgsql-sql

"Sabin Coanda" <sabin.coanda@deuromedia.ro> writes:
> I have two queries:

> 1. SELECT i AS "PK_ID", d AS "Deleted" FROM ( SELECT 52 AS i, true AS d  ) 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



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: alias not applied
@ 2007-02-09 16:35  Sabin Coanda <sabin.coanda@deuromedia.ro>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Sabin Coanda @ 2007-02-09 16:35 UTC (permalink / raw)
  To: pgsql-sql

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" <tgl@sss.pgh.pa.us> wrote in message 
news:961.1171038340@sss.pgh.pa.us...
> "Sabin Coanda" <sabin.coanda@deuromedia.ro> 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
> 





^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2007-02-09 16:35 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-02-09 16:04 alias not applied Sabin Coanda <sabin.coanda@deuromedia.ro>
2007-02-09 16:19 ` Frank Bax <fbax@sympatico.ca>
2007-02-09 16:25 ` Tom Lane <tgl@sss.pgh.pa.us>
2007-02-09 16:35   ` Sabin Coanda <sabin.coanda@deuromedia.ro>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox