diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-11-05 20:17:18 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-11-05 20:17:18 +0000 |
commit | 53b4e469ca4bc68431edb377bd4723c0c6756cb3 (patch) | |
tree | 39e912b5adeb301a3e723a6c06b16c2eb481aaec /src/backend/utils/adt/trigfuncs.c | |
parent | 0db527c05b491570361d1c646c88b48a9ef5772d (diff) | |
download | postgresql-53b4e469ca4bc68431edb377bd4723c0c6756cb3.tar.gz postgresql-53b4e469ca4bc68431edb377bd4723c0c6756cb3.zip |
This maneuver really requires a comment ...
Diffstat (limited to 'src/backend/utils/adt/trigfuncs.c')
-rw-r--r-- | src/backend/utils/adt/trigfuncs.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/backend/utils/adt/trigfuncs.c b/src/backend/utils/adt/trigfuncs.c index 50516ee3376..791c4efbcd6 100644 --- a/src/backend/utils/adt/trigfuncs.c +++ b/src/backend/utils/adt/trigfuncs.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/utils/adt/trigfuncs.c,v 1.4 2008/11/05 19:15:15 adunstan Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/trigfuncs.c,v 1.5 2008/11/05 20:17:18 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -62,11 +62,17 @@ suppress_redundant_updates_trigger(PG_FUNCTION_ARGS) newheader = newtuple->t_data; oldheader = oldtuple->t_data; + /* + * We are called before the OID, if any, has been transcribed from the + * old tuple to the new (in heap_update). To avoid a bogus compare + * failure, copy the OID now. But check that someone didn't already put + * another OID value into newtuple. (That's not actually possible at + * present, but maybe someday.) + */ if (trigdata->tg_relation->rd_rel->relhasoids && !OidIsValid(HeapTupleHeaderGetOid(newheader))) HeapTupleHeaderSetOid(newheader, HeapTupleHeaderGetOid(oldheader)); - /* if the tuple payload is the same ... */ if (newtuple->t_len == oldtuple->t_len && newheader->t_hoff == oldheader->t_hoff && @@ -81,7 +87,6 @@ suppress_redundant_updates_trigger(PG_FUNCTION_ARGS) /* ... then suppress the update */ rettuple = NULL; } - - - return PointerGetDatum(rettuple); + + return PointerGetDatum(rettuple); } |