作者alpe (薛丁格的猫)
看板Database
标题Re: [SQL ] postgresql 复合主键无法被外键参考?
时间Thu Oct 30 21:15:24 2008
※ 引述《Bambe (肥儿)》之铭言:
: 有试过pkey不constraint直接 primary key ("Pkey1","Pkey2")
: 还是一样无法被 slave 资料表参考...
: 还有 slave 资料表直接在栏位後面接 reference 也不行QQ
: 还是一样一直出现42830的错误... Orz
create table tb_master(
"Pkey1" int not null ,
"Pkey2" int not null,
"Pkey3" int not null,
primary key ("Pkey1","Pkey2")
);
create table tb_slave(
"Pkey1" int not null,
"Pkey2" int not null,
CONSTRAINT "Ref_17" FOREIGN KEY ("Pkey1", "Pkey2")
REFERENCES "tb_master"("Pkey1", "Pkey2")
)
winXP postgreSql 8.2 很正常... ...
完全没有 error
--
Live Long and Prosper
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.217.33.143