pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: bret_stern@machinemanagement.com <bret_stern@machinemanagement.com>
To: Sándor Daku <daku.sandor@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Sort question - Fractions, Metric etc
Date: Sat, 14 Aug 2021 10:32:24 -0700
Message-ID: <20210814164221.CD2E8A0FF1@mail.machinemanagement.com> (raw)
In-Reply-To: <CAKyoTgbC4xa+HuCK4OqBWYBH-0fRuHup_MOH13zR+uwn=fJadA@mail.gmail.com>

Of course it's a complete disorganized mess..That'a the world I live in.Best thing is, I'm walking away with some new strategies.You guys rock
-------- Original message --------From: Sándor Daku <daku.sandor@gmail.com> Date: 8/14/21  10:19 AM  (GMT-08:00) To: Tom Lane <tgl@sss.pgh.pa.us> Cc: Adrian Klaver <adrian.klaver@aklaver.com>, Bret Stern <bret_stern@machinemanagement.com>, pgsql-general@lists.postgresql.org Subject: Re: Sort question - Fractions, Metric etc On Sat, 14 Aug 2021 at 19:03, Tom Lane <tgl@sss.pgh.pa.us> wrote:Adrian Klaver <adrian.klaver@aklaver.com> writes:
> On 8/14/21 9:37 AM, Bret Stern wrote:
>> I haven't explored doing this with numeric types, but some columns 
>> needed alpha chars eg 13mm.

> Two columns:

> data_val(numeric)     data_unit(varchar)
> 13                    mm

It sounds like your data is a completely disorganized mess :-(.
You might be able to bring some semblance of coherence to it with
an extension like postgresql-unit [1], but it will take a lot of
effort to get the data into a representation that can sort reasonably.
There's no "easy button" here.

                        regards, tom lane

[1] https://github.com/df7cb/postgresql-unitI'm not sure, but maybe a kind of cast function that cast everything into a reasonable common unit(Khm... millimeters) and sort on that? It seems relatively simple to pick up the value and unit from a string with a regexp. Admittedly the data would still be a mess.  Regards,Sándor


view thread (20+ messages)  latest in thread

Message-ID: <20210814164221.CD2E8A0FF1@mail.machinemanagement.com>
Permalink:  ../20210814164221.CD2E8A0FF1@mail.machinemanagement.com/
Also on:    postgresql.org/message-id/20210814164221.CD2E8A0FF1@mail.machinemanagement.com

 · 

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: bret_stern@machinemanagement.com, daku.sandor@gmail.com, tgl@sss.pgh.pa.us, adrian.klaver@aklaver.com
  Subject: Re: Sort question - Fractions, Metric etc
  In-Reply-To: <20210814164221.CD2E8A0FF1@mail.machinemanagement.com>
  References: <CAKyoTgbC4xa+HuCK4OqBWYBH-0fRuHup_MOH13zR+uwn=fJadA@mail.gmail.com> <20210814164221.CD2E8A0FF1@mail.machinemanagement.com>

* 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