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

From D'Arcy J.M. Cain
Subject Re: A minor correction in comment in heaptuple.c
Date
Msg-id 20130618131430.4668db12@imp
Whole thread Raw
In response to Re: A minor correction in comment in heaptuple.c  (Andres Freund <andres@2ndquadrant.com>)
Responses Re: A minor correction in comment in heaptuple.c  (Andres Freund <andres@2ndquadrant.com>)
List pgsql-hackers
On Tue, 18 Jun 2013 11:38:45 +0200
Andres Freund <andres@2ndquadrant.com> wrote:
> > How about "check if attnum is out of range according to the tupdesc"
> > instead?
> 
> I can't follow. Minus the word 'NULL' - which carries meaning - your
> suggested comment pretty much is the same as the existing comment
> except that you use 'check' instead of 'return'.

The difference is that I say what the purpose of the function is but
don't say what it actually returns.  The code itself does that.

> Original:
>     /*
>      * return NULL if attnum is out of range according to the
> tupdesc */

Obviously wrong so it should be changed.  As for the exact wording,
flip a coin and get the bikeshed painted.  It's not all that critical.
You could probably leave out the comment altogether.  The code is
pretty short and self explanatory.

Perhaps the comment should explain why we don't test for negative
numbers.  I assume that that's an impossible situation.

-- 
D'Arcy J.M. Cain <darcy@druid.net>         |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 788 2246     (DoD#0082)    (eNTP)   |  what's for dinner.
IM: darcy@Vex.Net, VOIP: sip:darcy@Vex.Net



pgsql-hackers by date:

Previous
From: Hitoshi Harada
Date:
Subject: Re: extensible external toast tuple support
Next
From: Jeremy Evans
Date:
Subject: LEFT JOIN LATERAL can remove rows from LHS