X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7580E9DC9A7 for ; Tue, 21 Mar 2006 18:24:02 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 78815-01 for ; Tue, 21 Mar 2006 18:24:03 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svana.org (svana.org [125.62.94.225]) by postgresql.org (Postfix) with ESMTP id C835E9DC809 for ; Tue, 21 Mar 2006 18:23:59 -0400 (AST) Received: from kleptog by svana.org with local (Exim 4.50) id 1FLpGh-0004c9-56; Wed, 22 Mar 2006 09:23:59 +1100 Date: Tue, 21 Mar 2006 23:23:59 +0100 From: Martijn van Oosterhout To: Andrew Dunstan Cc: Peter Eisentraut , pgsql-hackers@postgresql.org, Bruce Momjian Subject: Re: [GENERAL] A real currency type Message-ID: <20060321222359.GI11045@svana.org> Reply-To: Martijn van Oosterhout References: <200603211349.k2LDnIR15871@candle.pha.pa.us> <200603212130.52525.peter_e@gmx.net> <44206933.6050603@dunslane.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="4LwthZj+AV2mq5CX" Content-Disposition: inline In-Reply-To: <44206933.6050603@dunslane.net> X-PGP-Key-ID: Length=1024; ID=0x0DC67BE6 X-PGP-Key-Fingerprint: 295F A899 A81A 156D B522 48A7 6394 F08A 0DC6 7BE6 X-PGP-Key-URL: User-Agent: Mutt/1.5.9i X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: kleptog@svana.org X-SA-Exim-Scanned: No (on svana.org); SAEximRunCond expanded to false X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.124 required=5 tests=[AWL=0.124] X-Spam-Score: 0.124 X-Spam-Level: X-Archive-Number: 200603/895 X-Sequence-Number: 81293 --4LwthZj+AV2mq5CX Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Mar 21, 2006 at 03:59:31PM -0500, Andrew Dunstan wrote: > >I think such types would be better implemented as some sort of=20 > >structured type, possibly with constructors and methods and all the=20 > >other stuff that SQL talks about. We don't have all of that yet --=20 > >maybe we don't need all of it immediately -- but before we start=20 > >endorsing many of these types I'd like to see some consideration given= =20 > >to this issue. >=20 > Yeah, looks interesting but let's find the wrinkles. I was wondering if= =20 > it might have relevance to what I wanted to do with enumeration types,=20 > i.e. we would tag each one with its particular enumeration id. I have considered making enumeration types with this. It would probably work but kind of overkill. The main problem being that this code is seriously aimed at creating new types that you intend to do operations on, create operators for. An enumeration is just that, an enumeration. > I also don't like the idea of it being done with user tables - if this=20 > is core material then the tags should go in the catalog, ISTM. But the user is providing the list of tags when creating the type. Unless you are proposing copying the tag table to the catalog when the type is created? You can't store all the tags for all tagged types in one tag table either. At least, that wasn't what I was envisiging. See the currency type where the tag-table also stores the format string for output. No other tagged type is going to need that information. SQL types with constructors and methods might provide this also, I don't know. My purpose with this was allowing people to simply create new types with specific behaviour without writing functions in C. Right now type input/output functions cannot be written in anything other than C. Here are a few C functions that handle these new types in a generic way and user can write little pl/pgsql wrappers to customise the output. Have a ncie day, --=20 Martijn van Oosterhout 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. --4LwthZj+AV2mq5CX Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFEIHz/IB7bNG8LQkwRAsZ7AJ9gJsLIIfURWM8oRH0XK+jO2zYplACghWhw 7OvmEfVVy/IuZWIDHXRkSQQ= =SKPt -----END PGP SIGNATURE----- --4LwthZj+AV2mq5CX--