Re: Extended unit

Поиск
Список
Период
Сортировка
От Pailloncy Jean-Gerard
Тема Re: Extended unit
Дата
Msg-id 404BC0C9-6F22-11D9-9590-000A95DE2550@rilk.com
обсуждение исходный текст
Ответ на Re: Extended unit  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Extended unit  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Extended unit  (Martijn van Oosterhout <kleptog@svana.org>)
Список 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


В списке pgsql-general по дате отправления:

Предыдущее
От: James Thompson
Дата:
Сообщение: Re: Data entry - forms design or other APIs etc. - what is there?
Следующее
От: David Siebert
Дата:
Сообщение: Problem with Postgres V 8 and DBI maybe