pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Martijn van Oosterhout <kleptog@svana.org>
To: Andrew Dunstan <andrew@dunslane.net>
Cc: Peter Eisentraut <peter_e@gmx.net>
Cc: pgsql-hackers@postgresql.org
Cc: Bruce Momjian <pgman@candle.pha.pa.us>
Subject: Re: [GENERAL] A real currency type
Date: Tue, 21 Mar 2006 23:23:59 +0100
Message-ID: <20060321222359.GI11045@svana.org> (raw)
In-Reply-To: <44206933.6050603@dunslane.net>
References: <200603211349.k2LDnIR15871@candle.pha.pa.us>
	<200603212130.52525.peter_e@gmx.net>
	<44206933.6050603@dunslane.net>

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 
> >structured type, possibly with constructors and methods and all the 
> >other stuff that SQL talks about.  We don't have all of that yet -- 
> >maybe we don't need all of it immediately -- but before we start 
> >endorsing many of these types I'd like to see some consideration given 
> >to this issue.
> 
> Yeah, looks interesting but let's find the wrinkles. I was wondering if 
> it might have relevance to what I wanted to do with enumeration types, 
> 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 
> 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,

-- 
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.

Attachments:

  signature.asc (application/pgp-signature, 188B) download

view thread (23+ messages)  latest in thread

Message-ID: <20060321222359.GI11045@svana.org>
Permalink:  ../20060321222359.GI11045@svana.org/
Also on:    postgresql.org/message-id/20060321222359.GI11045@svana.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: kleptog@svana.org, andrew@dunslane.net, peter_e@gmx.net, pgsql-hackers@postgresql.org, pgman@candle.pha.pa.us
  Subject: Re: [GENERAL] A real currency type
  In-Reply-To: <20060321222359.GI11045@svana.org>
  References: <200603211349.k2LDnIR15871@candle.pha.pa.us> <200603212130.52525.peter_e@gmx.net> <44206933.6050603@dunslane.net> <20060321222359.GI11045@svana.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox