pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alexey M Boltenkov <padrebolt@yandex.ru>
To: David G. Johnston <david.g.johnston@gmail.com>
To: Gavan Schneider <list.pg.gavan@pendari.org>
Cc: Pgsql-admin <pgsql-admin@lists.postgresql.org>
Cc: Sbob <sbob@quadratum-braccas.com>
Subject: Re: sort output per alpha-numeric?
Date: Thu, 2 Dec 2021 08:40:09 +0300
Message-ID: <b9488ae2-54a9-9411-c09d-b5916803211b@yandex.ru> (raw)
In-Reply-To: <CAKFQuwb3n6gvEPB_w=RuV3kW2QmNXoEOqH7yyumJatj6aSAtwA@mail.gmail.com>
References: <6b1034cc-d98d-f3a7-6dd9-264bb0f934d8@quadratum-braccas.com>
	<CAKFQuwYL_gQ9JoPehdCj8NKevW77636xSNr2PvSR_BS+8_KhnQ@mail.gmail.com>
	<3ADA4F64-1223-44EF-97E1-0BCA1D9A643F@pendari.org>
	<CAKFQuwb3n6gvEPB_w=RuV3kW2QmNXoEOqH7yyumJatj6aSAtwA@mail.gmail.com>

On 12/02/21 02:55, David G. Johnston wrote:
> On Wed, Dec 1, 2021 at 4:35 PM Gavan Schneider 
> <list.pg.gavan@pendari.org <mailto:list.pg.gavan@pendari.org>> wrote:
>
>     On 2 Dec 2021, at 9:50, David G. Johnston wrote:
>
>         On Wed, Dec 1, 2021 at 3:38 PM Sbob
>         <sbob@quadratum-braccas.com
>         <mailto:sbob@quadratum-braccas.com>> wrote:
>
>             I want the displayed print\_size to be ordered by size
>             (8x10, then 11x14, etc)
>
>             Is there an easy way to do this?
>
>         You can sort by an expression. For the data as shown the
>         following should
>
>
>     A little more heavy handed might be to convert the two numbers
>     into a single integer for ranking, e.g.,
>
> Good idea, but "replace(print_size, 'x', '0')::integer" seems like a 
> simpler implementation - though I'd want to double-check some 
> single-digit scenarios before making a final choice (if there are any 
> besides "8" to worry about).
>
> David J.
>
Natural sort may be less invasive.

order by length(print_size), print_size

view thread (8+ messages)  latest in thread

Message-ID: <b9488ae2-54a9-9411-c09d-b5916803211b@yandex.ru>
Permalink:  ../b9488ae2-54a9-9411-c09d-b5916803211b@yandex.ru/
Also on:    postgresql.org/message-id/b9488ae2-54a9-9411-c09d-b5916803211b@yandex.ru

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: padrebolt@yandex.ru, david.g.johnston@gmail.com, list.pg.gavan@pendari.org, pgsql-admin@lists.postgresql.org, sbob@quadratum-braccas.com
  Subject: Re: sort output per alpha-numeric?
  In-Reply-To: <b9488ae2-54a9-9411-c09d-b5916803211b@yandex.ru>

* 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