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

Commit34479d9

Browse files
committed
Remove dead foreign key optimization code
The ri_KeysEqual() calls in the foreign-key trigger functions tooptimize away some updates are useless because sinceadfeef5 those triggers are not enqueuedat all. (It's also not useful to keep these checks as some kind ofbackstop, since it's also semantically correct to just run the fullcheck even with equal keys.)Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
1 parent5fde047 commit34479d9

File tree

1 file changed

+0
-51
lines changed

1 file changed

+0
-51
lines changed

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

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -744,20 +744,6 @@ ri_restrict(TriggerData *trigdata, bool is_no_action)
744744
break;
745745
}
746746

747-
/*
748-
* In UPDATE, no need to do anything if old and new keys are equal
749-
*/
750-
if (TRIGGER_FIRED_BY_UPDATE(trigdata->tg_event))
751-
{
752-
HeapTuplenew_row=trigdata->tg_newtuple;
753-
754-
if (ri_KeysEqual(pk_rel,old_row,new_row,riinfo, true))
755-
{
756-
heap_close(fk_rel,RowShareLock);
757-
returnPointerGetDatum(NULL);
758-
}
759-
}
760-
761747
/*
762748
* If another PK row now exists providing the old key values, we
763749
* should not do anything. However, this check should only be
@@ -1098,15 +1084,6 @@ RI_FKey_cascade_upd(PG_FUNCTION_ARGS)
10981084
break;
10991085
}
11001086

1101-
/*
1102-
* No need to do anything if old and new keys are equal
1103-
*/
1104-
if (ri_KeysEqual(pk_rel,old_row,new_row,riinfo, true))
1105-
{
1106-
heap_close(fk_rel,RowExclusiveLock);
1107-
returnPointerGetDatum(NULL);
1108-
}
1109-
11101087
if (SPI_connect()!=SPI_OK_CONNECT)
11111088
elog(ERROR,"SPI_connect failed");
11121089

@@ -1316,20 +1293,6 @@ ri_setnull(TriggerData *trigdata)
13161293
break;
13171294
}
13181295

1319-
/*
1320-
* In UPDATE, no need to do anything if old and new keys are equal
1321-
*/
1322-
if (TRIGGER_FIRED_BY_UPDATE(trigdata->tg_event))
1323-
{
1324-
HeapTuplenew_row=trigdata->tg_newtuple;
1325-
1326-
if (ri_KeysEqual(pk_rel,old_row,new_row,riinfo, true))
1327-
{
1328-
heap_close(fk_rel,RowExclusiveLock);
1329-
returnPointerGetDatum(NULL);
1330-
}
1331-
}
1332-
13331296
if (SPI_connect()!=SPI_OK_CONNECT)
13341297
elog(ERROR,"SPI_connect failed");
13351298

@@ -1536,20 +1499,6 @@ ri_setdefault(TriggerData *trigdata)
15361499
break;
15371500
}
15381501

1539-
/*
1540-
* In UPDATE, no need to do anything if old and new keys are equal
1541-
*/
1542-
if (TRIGGER_FIRED_BY_UPDATE(trigdata->tg_event))
1543-
{
1544-
HeapTuplenew_row=trigdata->tg_newtuple;
1545-
1546-
if (ri_KeysEqual(pk_rel,old_row,new_row,riinfo, true))
1547-
{
1548-
heap_close(fk_rel,RowExclusiveLock);
1549-
returnPointerGetDatum(NULL);
1550-
}
1551-
}
1552-
15531502
if (SPI_connect()!=SPI_OK_CONNECT)
15541503
elog(ERROR,"SPI_connect failed");
15551504

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp