Re: Sort question - Fractions, Metric etc - Mailing list pgsql-general

From Pól Ua Laoínecháin
Subject Re: Sort question - Fractions, Metric etc
Date
Msg-id CAF4RT5SFq2q9H4YUMHs6fzJZ=TFpOEj0h9wYyoCPUusZt7tkng@mail.gmail.com
Whole thread Raw
In response to Sort question - Fractions, Metric etc  (Bret Stern <bret_stern@machinemanagement.com>)
List pgsql-general
> I have a table with metric, imperial, fraction columns.

Have  "metric_equivalent_magnitude" and "metric_equivalent_unit"
columns and do all your sorting &c. via those columns. Use the
relatively new generated (or computed/calculated) columns to calculate
these. That way, you get the conversion correct once and you don't
have to worry about it any more!

That way, you can compare between cubits, furlongs and kilometres or
barrels, hogsheads and litres & American and British imperial units.

You might also want a metric_equivalent_type to ensure that you're not
comparing lengths with volumes, masses or velocities... &c...?

Pól...



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Sort question - Fractions, Metric etc
Next
From: Pól Ua Laoínecháin
Date:
Subject: Using a TRIGGER with window functions.