Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9926f85

Browse files
committed
Cache NO ACTION foreign keys separately from RESTRICT foreign keys
Now that we generate different SQL for temporal NO ACTION vs RESTRICTforeign keys, we should cache their query plans with different keys.Since the key also includes the constraint oid, this shouldn't benecessary, but we have been seeing build farm failures that suggest wemight be sometimes using a cached NO ACTION plan to implement a RESTRICTconstraint.Author: Paul A. Jungwirth <pj@illuminatedcomputing.com>Discussion:https://www.postgresql.org/message-id/flat/CA+renyUApHgSZF9-nd-a0+OPGharLQLO=mDHcY4_qQ0+noCUVg@mail.gmail.com
1 parenta925862 commit9926f85

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

‎src/backend/utils/adt/ri_triggers.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,13 @@
7474
/* these queries are executed against the FK (referencing) table: */
7575
#defineRI_PLAN_CASCADE_ONDELETE3
7676
#defineRI_PLAN_CASCADE_ONUPDATE4
77+
#defineRI_PLAN_NO_ACTION5
7778
/* For RESTRICT, the same plan can be used for both ON DELETE and ON UPDATE triggers. */
78-
#defineRI_PLAN_RESTRICT5
79-
#defineRI_PLAN_SETNULL_ONDELETE6
80-
#defineRI_PLAN_SETNULL_ONUPDATE7
81-
#defineRI_PLAN_SETDEFAULT_ONDELETE8
82-
#defineRI_PLAN_SETDEFAULT_ONUPDATE9
79+
#defineRI_PLAN_RESTRICT6
80+
#defineRI_PLAN_SETNULL_ONDELETE7
81+
#defineRI_PLAN_SETNULL_ONUPDATE8
82+
#defineRI_PLAN_SETDEFAULT_ONDELETE9
83+
#defineRI_PLAN_SETDEFAULT_ONUPDATE10
8384

8485
#defineMAX_QUOTED_NAME_LEN (NAMEDATALEN*2+3)
8586
#defineMAX_QUOTED_REL_NAME_LEN (MAX_QUOTED_NAME_LEN*2)
@@ -752,7 +753,7 @@ ri_restrict(TriggerData *trigdata, bool is_no_action)
752753
* Fetch or prepare a saved plan for the restrict lookup (it's the same
753754
* query for delete and update cases)
754755
*/
755-
ri_BuildQueryKey(&qkey,riinfo,RI_PLAN_RESTRICT);
756+
ri_BuildQueryKey(&qkey,riinfo,is_no_action ?RI_PLAN_NO_ACTION :RI_PLAN_RESTRICT);
756757

757758
if ((qplan=ri_FetchPreparedPlan(&qkey))==NULL)
758759
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp