Re: Typmod for user-defined types - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Typmod for user-defined types
Date
Msg-id 200508271352.j7RDq5j19606@candle.pha.pa.us
Whole thread Raw
In response to Typmod for user-defined types  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-hackers
We definitely need to allow user-types to use typmod.  If we don't
support this, it needs to be a TODO.  Added to TODO:

* Allow user-defined types to specify a type modifier at table creation time


---------------------------------------------------------------------------

Martijn van Oosterhout wrote:
-- Start of PGP signed section.
> [Please CC any replies, thanks]
> 
> Hi,
> 
> I've got a situation were I'd really like to be able to have a typmod
> for a user-defined type. In particular, I'd like to make use of the
> coerce_to_target_type()/coerce_type_typmod() chain. This only works if
> you have a typmod != -1.
> 
> Even if you set the typmod in pg_type, when you create a table it's not
> copied to the attribute but set back to -1.
> 
> This has been discussed before[1] and I notice Tom Lane posted a
> message about this back in June last year. I was wondering if it would
> be possible to allow user-defined types to declare a typmod function.
> 
> As an experiment I added arguments to GenericType but that gave
> reduce/reduce conflicts. OTOH if you just add to SimpleTypename it just
> works. I imagine this limits the places it can work.
> 
> Tom Lanes patch[2] looks like it may work, but would a mechanism to
> allow user-defined types to have a typmod function be accepted?
> 
> Have a nice day,
> 
> [1] http://archives.postgresql.org/pgsql-hackers/2004-06/msg00923.php
> [2] http://archives.postgresql.org/pgsql-hackers/2004-06/msg00932.php
> -- 
> 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.
-- End of PGP section, PGP failed!

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


pgsql-hackers by date:

Previous
From: Oleg Bartunov
Date:
Subject: bitmap scan cause core dump 8.1dev
Next
From: Michael Fuhr
Date:
Subject: Re: bitmap scan cause core dump 8.1dev