Typmod for user-defined types

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Typmod for user-defined types
Date: 2005-08-27 11:18:50
Message-ID: 20050827111846.GB27443@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(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.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2005-08-27 11:45:44 Re: Call for 7.5 feature completion
Previous Message Gavin Sherry 2005-08-27 10:03:36 Re: Call for 7.5 feature completion