假设我有一张schools
桌子
CREATE TABLE "public"."schools" (
"id" text NOT NULL,
"ancestor_id" text,
CONSTRAINT "schools_ancestor_id_fkey" FOREIGN KEY ("ancestor_id") REFERENCES "public"."schools"("id"),
PRIMARY KEY ("id")
);
我想插入多个值schools
INSERT INTO schools (id, ancestor_id) VALUES ('school 1', 'ancestor 1'), ('ancestor 1', NULL)
我预计插入查询会引发外键异常,但它实际上成功插入了 2 行。
有谁知道这是为什么?我查看了插入文档,但没有提到任何类似的情况。