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

Commit5357566

Browse files
committed
During looking stuff up for a discussion on -general, I realized that
I'd placed the check for newly created matching pk rows for on update noaction earlier than it needed to be so that it'd check even when the keyvalues hadn't changed. This patch moves it to after checking for NULLsin the old row and comparing the values since the select's probably moreexpensive.Stephan Szabo
1 parent9167a56 commit5357566

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

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

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*
1818
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
1919
*
20-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ri_triggers.c,v 1.50 2003/04/26 22:21:47 tgl Exp $
20+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ri_triggers.c,v 1.51 2003/06/11 15:02:25 momjian Exp $
2121
*
2222
* ----------
2323
*/
@@ -883,17 +883,6 @@ RI_FKey_noaction_upd(PG_FUNCTION_ARGS)
883883
old_row=trigdata->tg_trigtuple;
884884

885885
match_type=ri_DetermineMatchType(tgargs[RI_MATCH_TYPE_ARGNO]);
886-
if (ri_Check_Pk_Match(pk_rel,fk_rel,
887-
old_row,trigdata->tg_trigger->tgoid,
888-
match_type,tgnargs,tgargs))
889-
{
890-
/*
891-
* There's either another row, or no row could match this one. In
892-
* either case, we don't need to do the check.
893-
*/
894-
heap_close(fk_rel,RowShareLock);
895-
returnPointerGetDatum(NULL);
896-
}
897886

898887
switch (match_type)
899888
{
@@ -941,6 +930,18 @@ RI_FKey_noaction_upd(PG_FUNCTION_ARGS)
941930
returnPointerGetDatum(NULL);
942931
}
943932

933+
if (ri_Check_Pk_Match(pk_rel,fk_rel,
934+
old_row,trigdata->tg_trigger->tgoid,
935+
match_type,tgnargs,tgargs))
936+
{
937+
/*
938+
* There's either another row, or no row could match this one. In
939+
* either case, we don't need to do the check.
940+
*/
941+
heap_close(fk_rel,RowShareLock);
942+
returnPointerGetDatum(NULL);
943+
}
944+
944945
if (SPI_connect()!=SPI_OK_CONNECT)
945946
elog(ERROR,"SPI_connect() failed in RI_FKey_noaction_upd()");
946947

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp