pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andreas Joseph Krogh <andreas@visena.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: 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 15:36:06 +0200 (CEST)
Message-ID: <VisenaEmail.33.d65bf4e0fa1ac41d.1725b7dfe83@tc7-visena> (raw)
In-Reply-To: <6288.1590672402@sss.pgh.pa.us>
References: <VisenaEmail.2b.86f8bc58bbd29c56.1725b2fd4cc@tc7-visena>
	<CAEzk6fc_W3o9x18ZXF_G1rwpLWN6deP==XA2EUQQtFt-nPFjEg@mail.gmail.com>
	<VisenaEmail.31.f9b7c96fd0fa46d2.1725b5848c8@tc7-visena>
	<6288.1590672402@sss.pgh.pa.us>


På torsdag 28. mai 2020 kl. 15:26:42, skrev Tom Lane <tgl@sss.pgh.pa.us 
<mailto:tgl@sss.pgh.pa.us>>: 
Andreas Joseph Krogh <andreas@visena.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

view thread (5+ messages)

Message-ID: <VisenaEmail.33.d65bf4e0fa1ac41d.1725b7dfe83@tc7-visena>
Permalink:  ../VisenaEmail.33.d65bf4e0fa1ac41d.1725b7dfe83@tc7-visena/
Also on:    postgresql.org/message-id/VisenaEmail.33.d65bf4e0fa1ac41d.1725b7dfe83@tc7-visena

 · 

reply

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, tgl@sss.pgh.pa.us, pgsqladmin@geoff.dj
  Subject: Re: Order by lower(column-alias) doesn't work...
  In-Reply-To: <VisenaEmail.33.d65bf4e0fa1ac41d.1725b7dfe83@tc7-visena>
  References: <VisenaEmail.2b.86f8bc58bbd29c56.1725b2fd4cc@tc7-visena> <CAEzk6fc_W3o9x18ZXF_G1rwpLWN6deP==XA2EUQQtFt-nPFjEg@mail.gmail.com> <VisenaEmail.31.f9b7c96fd0fa46d2.1725b5848c8@tc7-visena> <6288.1590672402@sss.pgh.pa.us> <VisenaEmail.33.d65bf4e0fa1ac41d.1725b7dfe83@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