Re: Composite type

Поиск
Список
Период
Сортировка
От Chris Travers
Тема Re: Composite type
Дата
Msg-id CAKt_ZfvEscqNoqu1xQPiy8zK2=5f8bO6BHQoMAVsfWsc7f+Wxw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Composite type  (Kevin Grittner <kgrittn@ymail.com>)
Список pgsql-general

As a note, the following also works:

CREATE TYPE foo AS (bar text, baz int);
CREATE TABLE table_of_foo OF foo (primary key(bar));

The one thing that doesn't work is the REF syntax and the operators that go along with that.  However, you could come up with dereferencing functions and operators oneself.

Personally in this case I would probably use inheritance instead for the simple reason that tables can inherit but complex types cannot.  You can use CHECK(false) NOINHERIT to effectively relegate a table to a type if you have a sufficiently recent version of PostgreSQL.

Best Wishes,
Chris Travers

В списке pgsql-general по дате отправления:

Предыдущее
От: Raghavendra
Дата:
Сообщение: Re: PostgreSQL 9.2.4 using large amount of memory
Следующее
От: Craig Ringer
Дата:
Сообщение: Re: PostgreSQL specific datatypes very confusing for beginners who use wrappers around JDBC