Inherited tables and column references

Поиск
Список
Период
Сортировка
От Scott Goodwin
Тема Inherited tables and column references
Дата
Msg-id A960295A-633D-11D8-9E3E-000A95A0910A@scottg.net
обсуждение исходный текст
Ответы Re: Inherited tables and column references  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Список pgsql-general
In the following example:

create table parent (
    id         integer unique not null,
    name   varchar(24)
);

create table child (
    first_name   varchar(256),
    last_name   varchar(256)
) inherits (parent);

create table relations (
    id        integer references child (id)
);

Creating the relations table fails with:

    ERROR: there is no unique constraint maching given keys for
referenced table "child"

If I change the last table to:

create table relations (
    id        integer references parent (id)
);

it works.

This essentially means that references must point to the real table
where the referenced column is, and cannot point to that same column in
a table that inherits the real table.

is this by design, is it a bug, is it just not implemented yet, or am I
doing this wrong?


/s.


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

Предыдущее
От: "Roopali Sharma"
Дата:
Сообщение: Re: pg_restore problem
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: Inherited tables and column references