From: Andreas Joseph Krogh <andreas@visena.com>
To: Geoff Winkless <pgsqladmin@geoff.dj>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Order by lower(column-alias) doesn't work...
Date: Thu, 28 May 2020 14:55:55 +0200 (CEST)
Message-ID: <VisenaEmail.31.f9b7c96fd0fa46d2.1725b5848c8@tc7-visena> (raw)
In-Reply-To: <CAEzk6fc_W3o9x18ZXF_G1rwpLWN6deP==XA2EUQQtFt-nPFjEg@mail.gmail.com>
References: <VisenaEmail.2b.86f8bc58bbd29c56.1725b2fd4cc@tc7-visena>
<CAEzk6fc_W3o9x18ZXF_G1rwpLWN6deP==XA2EUQQtFt-nPFjEg@mail.gmail.com>
På torsdag 28. mai 2020 kl. 14:50:54, skrev Geoff Winkless <pgsqladmin@geoff.dj
<mailto:pgsqladmin@geoff.dj>>:
On Thu, 28 May 2020 at 13:14, Andreas Joseph Krogh <andreas@visena.com> 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: andreas@visena.com, pgsqladmin@geoff.dj
Subject: Re: Order by lower(column-alias) doesn't work...
In-Reply-To: <VisenaEmail.31.f9b7c96fd0fa46d2.1725b5848c8@tc7-visena>
References: <VisenaEmail.2b.86f8bc58bbd29c56.1725b2fd4cc@tc7-visena> <CAEzk6fc_W3o9x18ZXF_G1rwpLWN6deP==XA2EUQQtFt-nPFjEg@mail.gmail.com> <VisenaEmail.31.f9b7c96fd0fa46d2.1725b5848c8@tc7-visena>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox