Re: [GENERAL] inconsistency in aliasing

2009-01-15 Thread Grzegorz Jaƛkiewicz
as far as I know, this bit (statement evaluation) wasn't implemented then. It only got there in 8.4, so you can have even subselects evaluated. So it isn't a bug, it just wasn't implemented to work that way back than, -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make c

Re: [GENERAL] inconsistency in aliasing

2009-01-14 Thread Emanuel Calvo Franco
2009/1/14 Daniel Verite : >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_

Re: [GENERAL] inconsistency in aliasing

2009-01-14 Thread Daniel Verite
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

Re: [GENERAL] inconsistency in aliasing

2009-01-14 Thread Louis-David Mitterrand
On Wed, Jan 14, 2009 at 05:53:57AM -0800, Lennin Caro wrote: > --- On Wed, 1/14/09, Louis-David Mitterrand > wrote: > > > From: Louis-David Mitterrand > > Subject: Re: [GENERAL] inconsistency in aliasing > > To: pgsql-general@postgresql.org > > Date: Wedn

Re: [GENERAL] inconsistency in aliasing

2009-01-14 Thread Lennin Caro
--- On Wed, 1/14/09, Louis-David Mitterrand wrote: > From: Louis-David Mitterrand > 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

Re: [GENERAL] inconsistency in aliasing

2009-01-14 Thread Daniel Verite
Reg Me Please wrote: > 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 ? > > Thanks, Looks and smells like a bug. Read h

Re: [GENERAL] inconsistency in aliasing

2009-01-14 Thread Scott Marlowe
On Wed, Jan 14, 2009 at 3:46 AM, Louis-David Mitterrand 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:

Re: [GENERAL] inconsistency in aliasing

2009-01-14 Thread A. Kretschmer
In response to Louis-David Mitterrand : > > 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

Re: [GENERAL] inconsistency in aliasing

2009-01-14 Thread Louis-David Mitterrand
On Wed, Jan 14, 2009 at 06:31:55PM +0700, dbalinglung wrote: > what for of the syntax command +1 on order by ? maybe just wrong to > given result about the error query on order by, it's BUG ? *PARSE ERROR* -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to

Re: [GENERAL] inconsistency in aliasing

2009-01-14 Thread dbalinglung
bject: [GENERAL] inconsistency in aliasing > 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; >

Re: [GENERAL] inconsistency in aliasing

2009-01-14 Thread Louis-David Mitterrand
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::ab

Re: [GENERAL] inconsistency in aliasing

2009-01-14 Thread ludwig
I don't know, if this is an inconsistence or a bug, but here a possible workaround: select current_timestamp::abstime::int4 as score, current_timestamp::abstime::int4 + 1 as "score + 1" order by "score + 1"; Ludwig This works: critik=# select current_timestamp::abstime::int4 as

Re: [GENERAL] inconsistency in aliasing

2009-01-14 Thread A. Kretschmer
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

Re: [GENERAL] inconsistency in aliasing

2009-01-14 Thread Reg Me Please
On Wednesday 14 January 2009 11:46:11 Louis-David Mitterrand 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: col

[GENERAL] inconsistency in aliasing

2009-01-14 Thread 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::i