Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mEx3u-0005hl-8z for pgsql-general@arkaria.postgresql.org; Sat, 14 Aug 2021 17:03:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mEx3t-0004ed-5b for pgsql-general@arkaria.postgresql.org; Sat, 14 Aug 2021 17:03:09 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mEx3s-0004eU-Ev for pgsql-general@lists.postgresql.org; Sat, 14 Aug 2021 17:03:08 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mEx3p-0006ZQ-UD for pgsql-general@lists.postgresql.org; Sat, 14 Aug 2021 17:03:07 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 17EH32df160751; Sat, 14 Aug 2021 13:03:02 -0400 From: Tom Lane To: Adrian Klaver cc: Bret Stern , pgsql-general@lists.postgresql.org Subject: Re: Sort question - Fractions, Metric etc In-reply-to: <0310c35b-10b1-83a2-4efc-7e569a634001@aklaver.com> References: <57f60e61-114f-c403-b2e2-820e76f08d64@machinemanagement.com> <24d005b3-47a4-3f78-450e-d394b9e47d6f@aklaver.com> <40fa1830-71d0-c908-ba5e-5c72cfbe9368@machinemanagement.com> <0310c35b-10b1-83a2-4efc-7e569a634001@aklaver.com> Comments: In-reply-to Adrian Klaver message dated "Sat, 14 Aug 2021 09:46:30 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <160749.1628960582.1@sss.pgh.pa.us> Date: Sat, 14 Aug 2021 13:03:02 -0400 Message-ID: <160750.1628960582@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Adrian Klaver 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-unit