Skip site navigation (1) Skip section navigation (2)

Re: New version of money type

From: tomas(at)tuxteam(dot)de
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: "Jim C(dot) Nasby" <jim(at)nasby(dot)net>, "D'Arcy J(dot)M(dot) Cain" <darcy(at)druid(dot)net>,llonergan(at)greenplum(dot)com, sfrost(at)snowman(dot)net,pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: New version of money type
Date: 2006-09-30 04:42:13
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
Hash: SHA1

On Fri, Sep 29, 2006 at 12:19:07PM +0200, Martijn van Oosterhout wrote:
> On Thu, Sep 28, 2006 at 06:32:11PM -0500, Jim C. Nasby wrote:
> > What would be ideal is a money type that stored what currency was used
> > and let you change precision (within reason).
> The taggedtypes version of currency does half of that, by storing the
> currency and allowing the output format to depend on that. It doesn't
> allow you to easily change the precision though, that would require
> user-defined typmod which is still under discussion.
> It would be possible to create a taggedtypes version of currency based
> on int64. With the currency tag it would be 12 bytes total. And the
> number of decimal places could be defined per currency...
> Interesting thought, probably wouldn't take more than an hour to whip
> up.

If you are at that, it's worth noting that the currency tag consists of
three capital ASCII letters. That would be fifteen bits, take or give.
That leaves fourty-eightish bits for the number or about 10^14.

THis is only half-serious, since there are other problems with
currencies (their value is dependent on time, all that Pandora's box).

- -- tomás
Version: GnuPG v1.4.1 (GNU/Linux)


In response to


pgsql-hackers by date

Next:From: David FetterDate: 2006-09-30 05:43:53
Subject: Re: New version of money type
Previous:From: Bruce MomjianDate: 2006-09-30 03:55:18
Subject: Re: Per-database search_path

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group