Re: Why lower's not accept an AS declaration ? - Mailing list pgsql-general

From Hervé Piedvache
Subject Re: Why lower's not accept an AS declaration ?
Date
Msg-id 200308181754.41523.herve@elma.fr
Whole thread Raw
In response to Re: Why lower's not accept an AS declaration ?  (Darko Prenosil <darko.prenosil@finteh.hr>)
Responses Re: Why lower's not accept an AS declaration ?  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
List pgsql-general
Hi,

Le Lundi 18 Août 2003 13:15, Darko Prenosil a écrit :
> On Monday 18 August 2003 13:04, Darko Prenosil wrote:
> > On Monday 18 August 2003 10:20, Hervé Piedvache wrote:
> > > Hi,
> > >
> > > May be my question is stupid ... but I'm a little suprised :
> > >
> > > SELECT id_letter as letter from my_table;
> > >
> > > letter
> > > -----
> > > B
> > > C
> > > a
> > > A
> > >
> > > SELECT id_letter as letter from my_table order by letter;
> > >
> > > letter
> > > -----
> > > A
> > > B
> > > C
> > > a
> > >
> > > SELECT id_letter as letter from my_table order by lower(letter);
> > >
> > > ERROR:  Attribute "letter" not found
> >
> > Why did you change column name to "letter" in last query, and all the
> > other queries have "id_letter" as column name. What is table structure
> > exactly ? I assume that You don't have column with "letter" at all.
> >
> > Regards !
>
> OK, now I see exactly the mistake You are making:
>
>     SELECT id_letter as letter from my_table order by lower(id_letter);
>
> would be correct query, because "letter" is only alias for result column,
> not column in "my_table". Sorry I didn't see it first time.

Mistake ? Why a mistake ... it's as you said an alias ... for result ... I
know that ... but why order by my alias is running ... and NOT an order by
with a LOWER() function call is not running ... that's mean LOWER() do not
accept alias ... but ORDER accept ... so sorry for me it's not so logical !
;o)

Regards,
--
Hervé Piedvache

Elma Ingénierie Informatique
6 rue du Faubourg Saint-Honoré
F-75008 - Paris - France
Pho. 33-144949901
Fax. 33-144949902


pgsql-general by date:

Previous
From: Hervé Piedvache
Date:
Subject: Re: Why lower's not accept an AS declaration ?
Next
From: Adam Kavan
Date:
Subject: Re: can't find files in pg_clog and invalid page