从名字的角度来看,我以为“ ON DELETE RESTRICT”会触发它,但是会触发错误23503(违反FK):
create table a (id serial primary key);
insert into a default values;
create table b (id serial primary key, a_id integer references a (id) not null);
insert into b (a_id) values (1);
delete from a where id=1;
ERROR: 23503: update or delete on table "a" violates foreign key constraint "b_a_id_fkey" on table "b"
DETAIL: Key (id)=(1) is still referenced from table "b".
SCHEMA NAME: public
TABLE NAME: b
CONSTRAINT NAME: b_a_id_fkey
LOCATION: ri_ReportViolation, ri_triggers.c:2797
答案 0 :(得分:0)
在IRC上进行了询问并检查了代码,它看起来很像23001,尽管它可能是由存储的proc等生成的,但在标准的postgresql中目前没有出现。