Re: User-defined typle similar to char(length)

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Martijn van Oosterhout <kleptog(at)svana(dot)org>, Teodor Sigaev <teodor(at)sigaev(dot)ru>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: User-defined typle similar to char(length)
Date: 2006-08-04 20:58:26
Message-ID: 1154725106.11043.18.camel@dogma.v10.wvs
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim C. Nasby 2006-08-04 21:06:42 Re: 8.2 features status
Previous Message David Fetter 2006-08-04 20:48:02 Re: 8.2 features status