diff options
author | Tomas Vondra | 2016-08-27 23:32:44 +0000 |
---|---|---|
committer | Pavan Deolasee | 2016-10-18 10:07:47 +0000 |
commit | c8fdcf03110277768617081b1dc5c3c88329dffc (patch) | |
tree | b325f3b9ba8c186eafb67ab0d5fb4e597ef029b3 | |
parent | 2c7cb327f2424fb9acaf21e93614942e29c20c68 (diff) |
change tts_tupleDescriptor/tts_datarow checks into asserts
The following check at the beginning of slot_deform_datarow
if (slot->tts_tupleDescriptor == NULL || slot->tts_datarow == NULL)
return;
was replaced with two asserts, enforcing the same conditions (except
that instead of silently returning it'll cause failure).
Silently ignoring such condition seems quite suspicious, and likely
only masks other errors - for example why should it be OK to call
this function without a data row?
This change seems safe, because all current callers already access
tts_tupleDescriptor - for example in the fastpath checks - and so
this field can't ever be NULL here. Also, we only call this function
after explicitly checking tts_datarow, so that can't be NULL either.
-rw-r--r-- | src/backend/access/common/heaptuple.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c index 49c4988d6e..79766121c3 100644 --- a/src/backend/access/common/heaptuple.c +++ b/src/backend/access/common/heaptuple.c @@ -1224,8 +1224,8 @@ slot_deform_datarow(TupleTableSlot *slot) uint32 n32; MemoryContext oldcontext; - if (slot->tts_tupleDescriptor == NULL || slot->tts_datarow == NULL) - return; + Assert(slot->tts_tupleDescriptor != NULL); + Assert(slot->tts_datarow != NULL); natts = slot->tts_tupleDescriptor->natts; |