Open michae2 opened 9 months ago
We should probably only do this if the column types in the FK constraint are the exact same in the parent and child table. Otherwise this could break FK integrity. See https://cockroachlabs.slack.com/archives/G01R3EYPQKA/p1706899796907879?thread_ts=1706898292.393169&cid=G01R3EYPQKA for more details.
We also want to avoid doing this if there are BEFORE triggers on the child table. See #133220 and #133784 and #133787 for discussion.
When we plan a FK cascade, the cascade plan includes a check of the FK that caused the cascade in the first place. I think we can safely elide this check.
Here's a demonstration using master (
v24.1.0-alpha.00000000-dev
):The update plan now includes the plan for the cascade to
c
which checksp
. We can skip this check ofp
. (Of course, ifc
had other FK checks we should not skip those unless we can prove that they are also superfluous.)Jira issue: CRDB-35830