Foreign Key problem

Поиск
Список
Период
Сортировка
Искать

Foreign Key problem

От:
David Mulcahy <eseol@mersinet.co.uk>
Дата:
I am having problems trying to create the following.  Any suggestions
would be greatly appreciated.

CREATE TABLE "t0" (
	"id" integer,
	"table" character(1),
	"product" character(1),
	Primary Key ("id", "table")
);

CREATE TABLE "t1" (
	"id" integer,
	"table" character(1),
	"product" text,
	Primary Key ("id", "table")
);
CREATE TABLE "t3" (
	"num" integer,
	"id" integer REFERENCES t0 and t1,
	"table" character(1) REFERENCES t0 and t1,
	Primary Key ("num", "id", "table")
);

Is it possible to have a foreign key reference two tables like in the
above example if so how would I do it. I am using postgresql v 7.1.2.

Thanks in advance
David Mulcahy
FAQ