pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andreas Joseph Krogh <andreas@visena.com>
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 09:26:42 -0400
Message-ID: <6288.1590672402@sss.pgh.pa.us> (raw)
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>

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





view thread (5+ messages)  latest in thread

Message-ID: <6288.1590672402@sss.pgh.pa.us>
Permalink:  ../6288.1590672402@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/6288.1590672402@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, andreas@visena.com, pgsqladmin@geoff.dj
  Subject: Re: Order by lower(column-alias) doesn't work...
  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>

* 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