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