sorting/comparing column values in non-alphanumeric sorting ways ?

From: David Gauthier <davegauthierpg(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: sorting/comparing column values in non-alphanumeric sorting ways ?
Date: 2018-07-11 21:44:01
Message-ID: CAMBRECCQamT3kn6ktSujnVgbYaTY+4rDNC3h-KB=xfqifmGyfQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi:

I have a table listing tools and tool versions for a number of different
tool configurations. Something like this...

create table tv (tool text, tcfg1 test, tcfg2 text, tcfg3 text, highestver
text);

insert into tv (tool,tcfg1mtcfg2,tcfg3) values
('tool_a','1.0.5b','1.0.10','1.0.9');

I want to load the 'highestver' column with the highest version of tcfg1-3.

This won't work...
update tv set greatest = greatest(tcfg1,tcfg2,tcfg3)
...because it thinks 1.0.9 is greater than 1.0.10

Is there a way to get this to work right ?

Thanks in Advance !

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2018-07-11 21:50:21 Re: sorting/comparing column values in non-alphanumeric sorting ways ?
Previous Message Adrian Klaver 2018-07-11 21:31:52 Re: timestamp (military) at time zone without the suffix