Search Postgresql Archives

Re: Composite type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux