Re: User-defined typle similar to char(length) - Mailing list pgsql-hackers

From Jeff Davis
Subject Re: User-defined typle similar to char(length)
Date
Msg-id 1154725106.11043.18.camel@dogma.v10.wvs
Whole thread Raw
In response to Re: User-defined typle similar to char(length) varchar(length)  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: 8.2 features status
Next
From: "Jim C. Nasby"
Date:
Subject: Re: 8.2 features status