默认为MATCH SIMPLE.它们如何运作?
检查CREATE TABLE
page of the manual: There are three match types:
MATCH FulL
,MATCH PARTIAL
,andMATCH SIMPLE
(which is the default).MATCH FulL
will not allow one column of
a multicolumn foreign key to be null unless all foreign key columns
are null; if they are all null,the row is not required to have a
match in the referenced table.MATCH SIMPLE
allows any of the foreign
key columns to be null; if any of them are null,the row is not
required to have a match in the referenced table.MATCH PARTIAL
is not
yet implemented. (Of course,NOT NulL
constraints can be applIEd to
the referencing column(s) to prevent these cases from arising.)
另外,在chapter on Foreign Keys:
normally,a referencing row need not satisfy the foreign key
constraint if any of its referencing columns are null. IfMATCH FulL
is added to the foreign key declaration,a referencing row escapes
satisfying the constraint only if all its referencing columns are null
(so a mix of null and non-null values is guaranteed to fail aMATCH FulL
constraint). If you don’t want referencing rows to be able to
avoID satisfying the foreign key constraint,declare the referencing
column(s) asNOT NulL
.
请务必参考当前的手册. (或者与您的安装相匹配的版本.)不要过时的@R_404_5561@链接指向过时的版本.
总结以上是内存溢出为你收集整理的postgresql – 在外键约束中MATCH FULL vs MATCH SIMPLE全部内容,希望文章能够帮你解决postgresql – 在外键约束中MATCH FULL vs MATCH SIMPLE所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)