pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: hamann.w@t-online.de
To: pgsql-general@lists.postgresql.org
Subject: SQL question
Date: 14 Jan 2023 16:32:56 -0000
Message-ID: <wolfgang-1230114173256.A0116016@linux-tuxedo> (raw)


Hi,

I have atable with a "name" column, and I order it usually
order by regexp_match(name, 'regex1'), regexp_match(name, 'regex2')
orthe equivalent
order by (regexp_match(name, 'regex1'))[1], (regexp_match(name, 'regex2'))[2]

Is there a wayto create a function so the statement could read
select ... order by myfunc(name)

Best regards
Wolfgang








view thread (71+ messages)

Message-ID: <wolfgang-1230114173256.A0116016@linux-tuxedo>
Permalink:  ../wolfgang-1230114173256.A0116016@linux-tuxedo/
Also on:    postgresql.org/message-id/wolfgang-1230114173256.A0116016@linux-tuxedo

 · 

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: hamann.w@t-online.de
  Subject: Re: SQL question
  In-Reply-To: <wolfgang-1230114173256.A0116016@linux-tuxedo>
  References: <wolfgang-1230114173256.A0116016@linux-tuxedo>

* 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