Re: User-Defined Datatypes
| От | Tom Lane |
|---|---|
| Тема | Re: User-Defined Datatypes |
| Дата | |
| Msg-id | 25556.1018897457@sss.pgh.pa.us обсуждение |
| Ответ на | User-Defined Datatypes (Philip Reimer <phre@wi.uni-muenster.de>) |
| Ответы |
Re: User-Defined Datatypes
|
| Список | pgsql-general |
Philip Reimer <phre@wi.uni-muenster.de> writes:
> Is it possible to create new structured datatypes in PostgreSQL like in this
> IBM UDB2 statement:
> create type person_t as (
> name varchar(30),
> car car_t)
> create type car_t as (
> model varchar(30),
> plate carchar(20))
> create table car of car_t
> create table person of person_t
We don't support that syntax, but you can achieve approximately the same
effect using inheritance:
create table person_t ( ... );
create table person () inherits(person_t);
Very often, the parent table of an inheritance relationship isn't
intended to ever actually contain any rows itself. In that case the
parent is effectively serving as a datatype, or at least you could
think of it that way.
regards, tom lane
В списке pgsql-general по дате отправления: