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

Поиск
Список
Период
Сортировка
От Jeff Davis
Тема Re: User-defined typle similar to char(length)
Дата
Msg-id 1154725106.11043.18.camel@dogma.v10.wvs
обсуждение исходный текст
Ответ на Re: User-defined typle similar to char(length) varchar(length)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: David Fetter
Дата:
Сообщение: Re: 8.2 features status
Следующее
От: "Jim C. Nasby"
Дата:
Сообщение: Re: 8.2 features status