Re: inconsistency in aliasing

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: inconsistency in aliasing
Date: 2009-01-14 11:41:40
Message-ID: dcc563d10901140341i7fe771eel85863482285378e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Wed, Jan 14, 2009 at 3:46 AM, Louis-David Mitterrand
<vindex+lists-pgsql-general(at)apartia(dot)org> wrote:
> Hi,
>
> This works:
>
> critik=# select current_timestamp::abstime::int4 as score order by score;
>
> This doesn't:
>
> critik=# select current_timestamp::abstime::int4 as score order by score + 1;
> ERROR: column "score" does not exist
> LINE 1: ...urrent_timestamp::abstime::int4 as score order by score + 1 ...

A number in an order by refers to a column.

select a, b, c/d as f from table order by 3;

will order by the third field in the select list. I'm guessing the +
1 is trying to add col 1 to a field it can't find. doubt it's a bug,
more like a quirk.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Emanuel Calvo Franco 2009-01-14 12:04:20 Re: [ADMIN] Problem with pg_dump
Previous Message A. Kretschmer 2009-01-14 11:38:19 Re: inconsistency in aliasing

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2009-01-14 11:44:23 Re: Updates of SE-PostgreSQL 8.4devel patches (r1403)
Previous Message A. Kretschmer 2009-01-14 11:38:19 Re: inconsistency in aliasing