Re: [GENERAL] A real currency type - Mailing list pgsql-hackers

From Martijn van Oosterhout
Subject Re: [GENERAL] A real currency type
Date
Msg-id 20060321190909.GG11045@svana.org
Whole thread Raw
In response to [GENERAL] A real currency type  ("Gregory Maxwell" <gmaxwell@gmail.com>)
List pgsql-hackers
On Tue, Mar 21, 2006 at 02:00:14PM -0500, Gregory Maxwell wrote:
> On 3/21/06, Jim C. Nasby <jnasby@pervasive.com> wrote:
> > ISTM that having a currency type is pretty common for most databases; I
> > don't really see any reason not to just include it. Likewise for a type
> > that actually stores timezone info with a timestamp.
>
> This really should be generalized to work with all the base types
> because there are strong use cases for each. (timezones with
> timestamps, currencies with numeric, physical units with floats and
> ints)

Have you looked at the code? It *is* generalised. All you need to do is
provide a table of tags and indicate the base-type. Hence:

currency type = table of currencies + numeric base type
timestamp+zone type = table of timezones + timestamp base type
physical unit = table of units + numeric base type

These are examples already included in the code, but I'm sure people
can come up with more.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

pgsql-hackers by date:

Previous
From: "Gregory Maxwell"
Date:
Subject: [GENERAL] A real currency type
Next
From: Simon Riggs
Date:
Subject: Re: Automatically setting work_mem