Re: inconsistency in aliasing

From: Emanuel Calvo Franco <postgres(dot)arg(at)gmail(dot)com>
To: General PostgreSQL List <pgsql-general(at)postgresql(dot)org>
Subject: Re: inconsistency in aliasing
Date: 2009-01-14 14:46:00
Message-ID: f205bb120901140646k5541639an9573349c1dda9488@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

2009/1/14 Daniel Verite <daniel(at)manitou-mail(dot)org>:
> Lennin Caro wrote:
>
>> select score,score+1 as score2 from (
>> select current_timestamp::abstime::int4 as score)
>> order by score2
>
> That additional score2 is not needed in the select output.
>
> This works just fine:
>
> => select score from (select current_timestamp::abstime::int4 as score)
> subsel order by score+1;
>

I'm been watching that the string name of order by with operator just work fine
if the column name is in the select clause. But if you use alias this
not work...

I'm don't believe is a bug, is a string name question. You can't add 1
to an alias,
but you can add 1 to a field... but the results is the same

> The point is that the subselect makes "score" available as a valid
> expression to the upper select.
>
> Best regards,
> --
> Daniel
> PostgreSQL-powered mail user agent and storage: http://www.manitou-mail.org
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

--
Emanuel Calvo Franco
ArPUG / AOSUG Member
Postgresql Support & Admin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Emanuel Calvo Franco 2009-01-14 14:51:09 Re: simple limit of decimals
Previous Message Daniel Verite 2009-01-14 14:21:02 Re: inconsistency in aliasing

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2009-01-14 14:46:19 Re: Updates of SE-PostgreSQL 8.4devel patches (r1403)
Previous Message Alvaro Herrera 2009-01-14 14:43:32 Re: reloptions with a "namespace"