Re: inconsistency in aliasing - Mailing list pgsql-general

From Louis-David Mitterrand
Subject Re: inconsistency in aliasing
Date
Msg-id 20090114140135.GA10284@apartia.fr
Whole thread Raw
In response to Re: inconsistency in aliasing  (Lennin Caro <lennin.caro@yahoo.com>)
List pgsql-general
On Wed, Jan 14, 2009 at 05:53:57AM -0800, Lennin Caro wrote:
> --- On Wed, 1/14/09, Louis-David Mitterrand <vindex+lists-pgsql-general@apartia.org> wrote:
>
> > From: Louis-David Mitterrand <vindex+lists-pgsql-general@apartia.org>
> > Subject: Re: [GENERAL] inconsistency in aliasing
> > To: pgsql-general@postgresql.org
> > Date: Wednesday, January 14, 2009, 11:27 AM
> > On Wed, Jan 14, 2009 at 12:06:47PM +0100, A. Kretschmer
> > wrote:
> > > In response to Louis-David Mitterrand :
> > > > 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 ...
> > > >
> > > > Any idea ?
> > >
> > > Yes, you can't use the alias in the ORDER BY. Use
> > the real column-name.
> > >
> > > select current_timestamp::abstime::int4 as score order
> > by
> > > current_timestamp::abstime::int4;
> >
> > Did you try
> >
> > "select current_timestamp::abstime::int4 as score
> > order by score;" ?
> >
> > This seems to be an "order by <alias>"
> >
> > --
> > http://www.critikart.net
> >
>
> you can't use operator in the group by, try this

Really?

select current_timestamp::abstime::int4 as score order by 1 + 1 ;

   score
   ------------
    1231941662
    (1 row)

--
http://www.critikart.net

pgsql-general by date:

Previous
From: "A. Kretschmer"
Date:
Subject: Re: simple limit of decimals
Next
From: "Daniel Verite"
Date:
Subject: Re: inconsistency in aliasing