Re: Extended unit

From: Pailloncy Jean-Gerard <jg(at)rilk(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Extended unit
Date: 2005-01-25 22:41:28
Message-ID: 404BC0C9-6F22-11D9-9590-000A95DE2550@rilk.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> ... none of which require any extensions to the core type system.
>
> AFAICS this could easily be implemented as a user-defined type, along
> the lines of
>
> CREATE TYPE measurement AS (value double, units text);
>
> and if you want to constrain a particular column to contain only one
> value of units, use CHECK.
>
> The argument that we should extend the type system for this would
> become
> a lot more credible if there were a widely-used extension in existence
> for it to prove that there's sufficient demand.
I have begining to put all the SI unit in a table.
I am writing the function to check the unit in a standard way.
I plan to use the user-defined type proposed by Tom Lane.
The check are done at execution time.

But I object that what I am doing is just a proof of concept and not
the right thing to do.
I do not want for each column and each row to store the value and the
unit.
I do want to put the unit in the definition of the column and the check
on the parser before any execution.

Cordialement,
Jean-Gérard Pailloncy

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Siebert 2005-01-25 22:49:11 Problem with Postgres V 8 and DBI maybe
Previous Message James Thompson 2005-01-25 22:29:02 Re: Data entry - forms design or other APIs etc. - what is there?