Re: sort output per alpha-numeric?

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Sbob <sbob(at)quadratum-braccas(dot)com>
Cc: Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: sort output per alpha-numeric?
Date: 2021-12-01 23:24:09
Message-ID: CAKFQuwZNkdXjmgiw-BWq=sSoDJEZdt6-QhERc30ZpWdkKRqUqg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Wed, Dec 1, 2021 at 3:50 PM David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
wrote:

> On Wed, Dec 1, 2021 at 3:38 PM Sbob <sbob(at)quadratum-braccas(dot)com> wrote:
>
>> I get a list like this:
>>
>> print_size
>> ------------
>> 11x14
>>
>> If this isn't sufficient (e.g., if the second dimension causes the issue)
> you may need to break the two-part string into two separate fields, convert
> them to integers, and then sort on the pair.
>
>
Just for some perspective - the normalized version of this model would
store the width and height measurements separately and your print_size text
would be a presentation issue. Though the use of a lookup table may ease
the usage of this somewhat.

Another possibility, one that I tend to avoid, would be to use an "enum"
type here - which has the property that the elements of the enum have an
order that is independent of the display value.

In short though, print_size as you've defined it is a composite value which
should be broken down into its components during the process of
normalization.

David J.

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Gavan Schneider 2021-12-01 23:35:26 Re: sort output per alpha-numeric?
Previous Message David G. Johnston 2021-12-01 22:50:11 Re: sort output per alpha-numeric?