Ordering Error

From: Jason Davis <jasdavis(at)tassie(dot)net(dot)au>
To: pgsql-novice(at)postgresql(dot)org
Subject: Ordering Error
Date: 2003-08-10 13:23:00
Message-ID: 5.1.0.14.0.20030810230808.01fbc070@pop.ltn.tassie.net.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi all

Searched the docs, archives etc. but can't find any reference to this
problem I'm having with ORDER BY used in conjunction with SELECT...AS.

A simplified demonstration:

radius=# SELECT col1 AS testing FROM test ORDER BY testing ASC;
testing
----------
Ordering
Test
This
an
is
(5 rows)

But I need the lowercased ordering result for this column for a
case-insensitivity listing, however I get

radius=# SELECT col1 AS testing FROM test ORDER BY lower(testing) ASC;
ERROR: Attribute "testing" not found

Using the ordinal notation (ie. ORDER BY lower(1) ASC) gives weird results
(in my original query).

I can't use ORDER BY lower(col1) in my original and more complex query as
the column is the result of a function.

What obviousness would I be missing here?

version = 7.3.2

cheers
Jason

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Nabil Sayegh 2003-08-10 13:46:47 Re: Ordering Error
Previous Message James Williams 2003-08-10 07:54:15 Re: Upgrade 7.2 to 7.3