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: 20060930044213.GA7205@www.trapp.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

-----BEGIN PGP SIGNED MESSAGE-----
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).

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFHfWlBcgs9XrR2kYRAhieAJ9GYKruXeW3nqGyg0TO8Mo5bFBNMQCfbfzK
lbARH+l5PxIexOElcxTg3WE=
=//LX
-----END PGP SIGNATURE-----

In response to

Responses

Browse pgsql-hackers by date

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