aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/trigger.c
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2019-02-06 01:09:32 -0800
committerAndres Freund <andres@anarazel.de>2019-02-06 01:09:32 -0800
commit171e0418b03dc103d5d9bdc0bfaadbb193dd7fd6 (patch)
treeff26943d0315fe748706952a9678eaeaf2ad86a5 /src/backend/commands/trigger.c
parentd07fb6810e51a676c4c631f673b8da09f63205b3 (diff)
downloadpostgresql-171e0418b03dc103d5d9bdc0bfaadbb193dd7fd6.tar.gz
postgresql-171e0418b03dc103d5d9bdc0bfaadbb193dd7fd6.zip
Fix heap_getattr() handling of fast defaults.
Previously heap_getattr() returned NULL for attributes with a fast default value (c.f. 16828d5c0273), as it had no handling whatsoever for that case. A previous fix, 7636e5c60f, attempted to fix issues caused by this oversight, but just expanding OLD tuples for triggers doesn't actually solve the underlying issue. One known consequence of this bug is that the check for HOT updates can return the wrong result, when a previously fast-default'ed column is set to NULL. Which in turn means that an index over a column with fast default'ed columns might be corrupt if the underlying column(s) allow NULLs. Fix by handling fast default columns in heap_getattr(), remove now superfluous expansion in GetTupleForTrigger(). Author: Andres Freund Discussion: https://postgr.es/m/20190201162404.onngi77f26baem4g@alap3.anarazel.de Backpatch: 11, where fast defaults were introduced
Diffstat (limited to 'src/backend/commands/trigger.c')
-rw-r--r--src/backend/commands/trigger.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c
index 7b5896b98f9..0b245a613e0 100644
--- a/src/backend/commands/trigger.c
+++ b/src/backend/commands/trigger.c
@@ -3412,10 +3412,7 @@ ltrmark:;
LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
}
- if (HeapTupleHeaderGetNatts(tuple.t_data) < relation->rd_att->natts)
- result = heap_expand_tuple(&tuple, relation->rd_att);
- else
- result = heap_copytuple(&tuple);
+ result = heap_copytuple(&tuple);
ReleaseBuffer(buffer);
return result;