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

From Martijn van Oosterhout
Subject Typmod for user-defined types
Date
Msg-id 20050827111846.GB27443@svana.org
Whole thread Raw
Responses Re: Typmod for user-defined types  (Bruce Momjian <pgman@candle.pha.pa.us>)
Re: Typmod for user-defined types  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
[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.

pgsql-hackers by date:

Previous
From: Gavin Sherry
Date:
Subject: Re: Call for 7.5 feature completion
Next
From: "Andrew Dunstan"
Date:
Subject: Re: Call for 7.5 feature completion