postgresql – 在外键约束中MATCH FULL vs MATCH SIMPLE

postgresql – 在外键约束中MATCH FULL vs MATCH SIMPLE,第1张

概述我在phpPgAdmin中注意到MATCH SIMPLE或MATCH FULL选项,但我在 docs中找不到描述. 默认为MATCH SIMPLE.它们如何运作? 检查 CREATE TABLE page of the manual: There are three match types: MATCH FULL, MATCH PARTIAL, and MATCH SIMPLE (which is 我在PHPPgadmin中注意到MATCH SIMPLE或MATCH FulL选项,但我在 docs中找不到描述.

默认为MATCH SIMPLE.它们如何运作?

检查 CREATE TABLE page of the manual:

There are three match types: MATCH FulL,MATCH PARTIAL,and MATCH 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. If MATCH 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 a MATCH FulL
constraint). If you don’t want referencing rows to be able to
avoID satisfying the foreign key constraint,declare the referencing
column(s) as NOT NulL.

请务必参考当前的手册. (或者与您的安装相匹配的版本.)不要过时的@R_404_5561@链接指向过时的版本.

总结

以上是内存溢出为你收集整理的postgresql – 在外键约束中MATCH FULL vs MATCH SIMPLE全部内容,希望文章能够帮你解决postgresql – 在外键约束中MATCH FULL vs MATCH SIMPLE所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/1167016.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-01
下一篇 2022-06-01

发表评论

登录后才能评论

评论列表(0条)

保存