From 171e0418b03dc103d5d9bdc0bfaadbb193dd7fd6 Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Wed, 6 Feb 2019 01:09:32 -0800 Subject: 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 --- src/backend/access/common/heaptuple.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/backend/access/common/heaptuple.c') diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c index ed4549ca579..783b04a3cb9 100644 --- a/src/backend/access/common/heaptuple.c +++ b/src/backend/access/common/heaptuple.c @@ -71,8 +71,6 @@ #define VARLENA_ATT_IS_PACKABLE(att) \ ((att)->attstorage != 'p') -static Datum getmissingattr(TupleDesc tupleDesc, int attnum, bool *isnull); - /* ---------------------------------------------------------------- * misc support routines @@ -82,7 +80,7 @@ static Datum getmissingattr(TupleDesc tupleDesc, int attnum, bool *isnull); /* * Return the missing value of an attribute, or NULL if there isn't one. */ -static Datum +Datum getmissingattr(TupleDesc tupleDesc, int attnum, bool *isnull) { -- cgit v1.2.3