Re: A minor correction in comment in heaptuple.c

From: Kevin Grittner <kgrittn(at)ymail(dot)com>
To: "D'Arcy J(dot)M(dot) Cain" <darcy(at)druid(dot)net>, Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Amit Langote <amitlangote09(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: A minor correction in comment in heaptuple.c
Date: 2013-06-18 18:04:25
Message-ID: 1371578665.93373.YahooMailNeo@web162906.mail.bf1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

D'Arcy J.M. Cain <darcy(at)druid(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2013-06-18 18:05:13 Re: extensible external toast tuple support
Previous Message Simon Riggs 2013-06-18 17:59:45 Re: SET work_mem = '1TB';