On Thu, 2006-08-03 at 17:04 -0400, Tom Lane wrote:
> Does anyone have examples of real user-defined types that would need two
> fields?  If not it may not be worth spending time on.
> 

What about if someone wanted to implement a relation as a type? I could
see perhaps something like:

CREATE TABLE (
  ...,
  t RELATION('attr1:type1','attr2:type2',...)
);

If we allowed multiple arguments to the type and an arbitrary-length
typmod, that would seem to allow a lot of functionality. It would be
quite esoteric, but might be useful to meet a strange requirement.

Also, it might help people port a database to PostgreSQL. For instance,
if they are using MySQL and use the "enum" type, they might not have the
time to change all the database schema to be relational. Instead, they
could create their own enum type in postgresql and it could work the
same way.

Regards,
        Jeff Davis


---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to [EMAIL PROTECTED] so that your
       message can get through to the mailing list cleanly

Reply via email to