Re: A minor correction in comment in heaptuple.c - Mailing list pgsql-hackers

From Kevin Grittner
Subject Re: A minor correction in comment in heaptuple.c
Date
Msg-id 1371578665.93373.YahooMailNeo@web162906.mail.bf1.yahoo.com
Whole thread Raw
In response to Re: A minor correction in comment in heaptuple.c  ("D'Arcy J.M. Cain" <darcy@druid.net>)
Responses Re: A minor correction in comment in heaptuple.c
List pgsql-hackers
D'Arcy J.M. Cain <darcy@druid.net>

> Although, the more I think about it, the more I think that the comment
> is both confusing and superfluous.  The code itself is much clearer.

Seriously, if there is any comment there at all, it should be a
succinct explanation for why we didn't do this (which passes `make
check-world`):

--- a/src/backend/access/common/heaptuple.c
+++ b/src/backend/access/common/heaptuple.c
@@ -1323,6 +1323,8 @@ slot_attisnull(TupleTableSlot *slot, int attnum)
    HeapTuple   tuple = slot->tts_tuple;
    TupleDesc   tupleDesc = slot->tts_tupleDescriptor;
 
+   Assert(attnum <= tupleDesc->natts);
+
    /*
     * system attributes are handled by heap_attisnull
     */
@@ -1342,12 +1344,6 @@ slot_attisnull(TupleTableSlot *slot, int attnum)
        return slot->tts_isnull[attnum - 1];
 
    /*
-    * return NULL if attnum is out of range according to the tupdesc
-    */
-   if (attnum > tupleDesc->natts)
-       return true;
-
-   /*
     * otherwise we had better have a physical tuple (tts_nvalid should equal
     * natts in all virtual-tuple cases)
     */

--
Kevin Grittner
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: SET work_mem = '1TB';
Next
From: Andres Freund
Date:
Subject: Re: extensible external toast tuple support