Skip site navigation (1) Skip section navigation (2)

upper() don't work with field-alias in the order by part of select statement.

From: Wjatscheslaw Wächter <waechter(at)comvos(dot)de>
To: pgsql-bugs(at)postgresql(dot)org
Subject: upper() don't work with field-alias in the order by part of select statement.
Date: 2001-09-06 09:50:48
Message-ID: 3B9746F8.4CDCEEFB@comvos.de (view raw or flat)
Thread:
Lists: pgsql-bugs
I need in some select-statements case-insensetiv ordering of results,
i want to use upper()-function in order by part of statement but it
doesn't work with field-aliases.
Can I do this in another way?
I'm using PostgreSql 7.1.2 on SuSe-Linux

Example:
    this works:
    select p1.prs_vorname as vorname, p1.prs_nachname as nachname,
           p1.lfdnr as lfdnr, pos.pos_name as position,
           p1.prs_email as email, abt.abt_name as abteilung
    from person p1 left join abteilung abt
           on abt.lfdnr = p1.prs_abt_lfdnr,
         person p2 left join positionen pos
           on pos.lfdnr=p2.prs_pos_lfdnr
    where   p1.lfdnr=p2.lfdnr
    ORDER BY nachname;

    this don't work:
    select p1.prs_vorname as vorname, p1.prs_nachname as nachname,
           p1.lfdnr as lfdnr, pos.pos_name as position,
           p1.prs_email as email, abt.abt_name as abteilung
    from person p1 left join abteilung abt
           on abt.lfdnr = p1.prs_abt_lfdnr,
         person p2 left join positionen pos
           on pos.lfdnr=p2.prs_pos_lfdnr
    where   p1.lfdnr=p2.lfdnr
    ORDER BY upper(nachname);

    ERROR:  Attribute 'nachname' not found



Responses

pgsql-bugs by date

Next:From: Colin 't HartDate: 2001-09-06 09:51:19
Subject: Re: I have a serious problem with hanging backends.
Previous:From: Reinhard MaxDate: 2001-09-06 09:43:12
Subject: Re: libpgtcl doesn't use UTF encoding of TCL

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group