From: | Andreas Joseph Krogh <andreas(at)visena(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Geoff Winkless <pgsqladmin(at)geoff(dot)dj>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Order by lower(column-alias) doesn't work... |
Date: | 2020-05-28 13:36:06 |
Message-ID: | VisenaEmail.33.d65bf4e0fa1ac41d.1725b7dfe83@tc7-visena |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
På torsdag 28. mai 2020 kl. 15:26:42, skrev Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us
<mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us>>:
Andreas Joseph Krogh <andreas(at)visena(dot)com> writes:
> 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?
You'd have to write your own type, which would be a lotta work :-(.
A possible partial answer is to define the composite type as
firstname citext, lastname citext, other-fields-here
and then the regular composite-type comparison rule would give you
approximately what you said you wanted ... but only approximately.
regards, tom lane
Hm, ok. I think the most non-intrusive way for me is to craft a sub-select
producing the "varchar-string-flattened" so I can order by that alias.
--
Andreas Joseph Krogh
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2020-05-28 14:15:17 | Re: Linux Update Experience |
Previous Message | Tom Lane | 2020-05-28 13:26:42 | Re: Order by lower(column-alias) doesn't work... |