Re: Creating a 'SET' type

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
Cc: "Pgsql-Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Creating a 'SET' type
Date: 2000-12-13 16:55:59
Message-ID: 9092.976726559@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au> writes:
> However, is it possible to create a type that has different parameters
> wherever it is used.
> For instance - the varchar type takes as a parameter the max characters in
> the field. Although there is only one varchar type, it has different
> properties depending on whether or not it is varchar(5) or varchar(20).

Right now, that support is hard-wired into the parser for each such type
(and there aren't many). It might be interesting to look at what it
would take to make a generalized mechanism whereby a type name could
accept parameters, with a type-specific routine being responsible for
reducing the parameters down to a typmod value. One problem you'd run
into, I think, is creation of parsing ambiguities --- is NUMERIC(9,2)
a type specification, or a function call? Right now it's a type spec
because NUMERIC is a keyword in the grammar, but that won't do for an
extensible mechanism.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message D=?ISO-8859-1?Q?=C5?= 2000-12-13 17:16:04 DB Algorithm Essay, please help
Previous Message D=?ISO-8859-1?Q?=C5?= 2000-12-13 16:54:24 Writing essay, please help!