Re: Typmod for user-defined types

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Typmod for user-defined types
Date: 2005-08-27 13:52:05
Message-ID: 200508271352.j7RDq5j19606@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)svana(dot)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(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Fuhr 2005-08-27 14:17:10 Re: bitmap scan cause core dump 8.1dev
Previous Message Oleg Bartunov 2005-08-27 13:21:46 bitmap scan cause core dump 8.1dev