INHERIT and FOREIGN KEY issues

Поиск
Список
Период
Сортировка
От Luiz Eduardo Cantanhede Neri
Тема INHERIT and FOREIGN KEY issues
Дата
Msg-id 252e1f290905241054w71f73101j1d5226fd8e6cffb2@mail.gmail.com
обсуждение исходный текст
Ответы Re: INHERIT and FOREIGN KEY issues  (Daniel Staal <DStaal@usa.net>)
Re: INHERIT and FOREIGN KEY issues  (Kedar Rasik Parikh <kedarr@netcore.co.in>)
Re: INHERIT and FOREIGN KEY issues  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-novice
Hi,

I'm trying to do something like this:

BEGIN;

CREATE TABLE A
(
idA serial not null primary key,
someColumn text
);

CREATE TABLE B
(
someData text
) INHERITS(A);

CREATE TABLE C
(
idC serial not null primary key,
anotherColumn text
);

CREATE TABLE BC(
idB int4,
idC int4,
 FOREIGN KEY (idB) REFERENCES B(idA),
 FOREIGN KEY (idC) REFERENCES C(idC)
);

COMMIT;

But When it is going to create the table BC, it gives an error:

ERROR:  there is no unique constraint matching given keys for referenced table "b"

My question is: Shouldn't it get Table A primary key and create the foreign key?

Thx
Luiz Eduardo

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

Предыдущее
От: Jasen Betts
Дата:
Сообщение: Re: FW: RETURNING in stored procedure
Следующее
От: Daniel Staal
Дата:
Сообщение: Re: INHERIT and FOREIGN KEY issues