Search Postgresql Archives

Re: Order by lower(column-alias) doesn't work...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



På torsdag 28. mai 2020 kl. 14:50:54, skrev Geoff Winkless <pgsqladmin@xxxxxxxx>:
On Thu, 28 May 2020 at 13:14, Andreas Joseph Krogh <andreas@xxxxxxxxxx> wrote:
> This works:
> select p.firstname, p.lastname, p.firstname || p.lastname as fullname from onp_crm_person p order by fullname;
>
> But this doesn't:
> select p.firstname, p.lastname, p.firstname || p.lastname as fullname from onp_crm_person p order by lower(fullname);
> ERROR:  column "fullname" does not exist
> LINE 1: ... as fullname from onp_crm_person p order by lower(fullname);

Wrap the original query in either a CTE or a temporary table.
eg
[..]
 
Yea, I was hoping to avoid that, as the query is generated and rewriting it is a pain...
 
Is there a way to define "sorting-rules" on custom-types so that I can have ORDER BY <my_array_of_custom_types_alias> and PG will pick my custom odering?
 
--
Andreas Joseph Krogh

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux