8000 This maneuver really requires a comment ... · postgrespro/postgres_cluster@53b4e46 · GitHub
[go: up one dir, main page]

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

Appearance settings

Commit 53b4e46

Browse files
committed
This maneuver really requires a comment ...
1 parent 0db527c commit 53b4e46

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/backend/utils/adt/trigfuncs.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/backend/utils/adt/trigfuncs.c,v 1.4 2008/11/05 19:15:15 adunstan Exp $
10+
* $PostgreSQL: pgsql/src/backend/utils/adt/trigfuncs.c,v 1.5 2008/11/05 20:17:18 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -62,11 +62,17 @@ suppress_redundant_updates_trigger(PG_FUNCTION_ARGS)
6262
newheader = newtuple->t_data;
6363
oldheader = oldtuple->t_data;
6464

65+
/*
66+
* We are called before the OID, if any, has been transcribed from the
67+
* old tuple to the new (in heap_update). To avoid a bogus compare
68+
* failure, copy the OID now. But check that someone didn't already put
69+
* another OID value into newtuple. (That's not actually possible at
70+
* present, but maybe someday.)
71+
*/
6572
if (trigdata->tg_relation->rd_rel->relhasoids &&
6673
!OidIsValid(HeapTupleHeaderGetOid(newheader)))
6774
HeapTupleHeaderSetOid(newheader, HeapTupleHeaderGetOid(oldheader));
6875

69-
7076
/* if the tuple payload is the same ... */
7177
if (newtuple->t_len == oldtuple->t_len &&
7278
newheader->t_hoff == oldheader->t_hoff &&
@@ -81,7 +87,6 @@ suppress_redundant_updates_trigger(PG_FUNCTION_ARGS)
8187
/* ... then suppress the update */
8288
rettuple = NULL;
8389
}
84-
85-
86-
return PointerGetDatum(rettuple);
90+
91+
return PointerGetDatum(rettuple);
8792
}

0 commit comments

Comments
 (0)
0