我在Ticket
表上有event_id
表,外键Event
。当我尝试在Event
表上执行简单操作时:
delete from event where id > 7
并尝试在其上使用explain
,它没有显示它正在按顺序扫描Ticket
表中的event_id FK,以确保没有Ticket
&# 39;引用Event
表。那是为什么?
取消删除后,postgres日志显示:
2017-10-13 14:56:38 PYST CONTEXT: statement SQL: «SELECT 1 FROM ONLY "public"."ticket" x WHERE $1 OPERATOR(pg_catalog.=) "event_id" FOR KEY SHARE OF x»
2017-10-13 14:56:38 PYST STATEMENT: delete from event where id > 27879