Re: Data Conversion - Mailing list pgsql-general

From Dann Corbit
Subject Re: Data Conversion
Date
Msg-id D425483C2C5C9F49B5B7A41F8944154757D4C3@postal.corporate.connx.com
Whole thread Raw
In response to Data Conversion  (Bob Pawley <rjpawley@shaw.ca>)
List pgsql-general
I would create functions.  Store the data in one format, and convert
with functions as needed on the fly.

E.g.:
SELECT Fahrenheit_to_Celcius(Fahrenheit_temp) FROM temperatures;

If that seems kludgy for the users, then create views for them that
perform the needed conversions using the functions.

Whatever the most frequently used units are, store on those units.  Then
the conversions are not needed as often.  E.g.:

CREATE VIEW Celcius_Temperatures AS
SELECT Fahrenheit_to_Celcius(Fahrenheit_temp) AS Celcius_Temp FROM
temperatures;

________________________________________
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org] On Behalf Of Bob Pawley
Sent: Tuesday, January 31, 2006 4:02 PM
To: Postgresql
Subject: [GENERAL] Data Conversion



I'm looking for ideas on the direction I should take.

I'm constructing an engineering database. I want to include the
capability of converting engineering data to different systems. For
instance - Fahrenheit to Celsius, lbs/hr to gph to gpm and to liters per
minute.

My thinking is bouncing between
    1 - creating a single table of data in the format of the users'
choice, then converting the data en masse as the user requests. Sort of
like conversion-on-demand.

    2 - creating tables for each format (for temperature that would
be one Fahrenheit table and one Celsius table) and do the conversion as
the data is entered.

Any thoughts on how best to accomplish this task with Postgresql would
be appreciated. (I'm on Windows XP)

Bob Pawley

pgsql-general by date:

Previous
From: Bob Pawley
Date:
Subject: Re: Data Conversion
Next
From: Michael Glaesemann
Date:
Subject: Re: Data Conversion