Re: Document and/or remove unreachable code in tuptoaster.c from varvarlena patch

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "PostgreSQL-development Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Document and/or remove unreachable code in tuptoaster.c from varvarlena patch
Date: 2007-08-05 17:34:00
Message-ID: 87fy2xkhrr.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches


"Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> Gregory Stark <stark(at)enterprisedb(dot)com> writes:
>> Testers here were having a hard time constructing test cases to reach some
>> lines touched by the varvarlena patch. Upon further investigation I'm
>> convinced they're unreachable.
>
> I'm not really happy with any of this patch. ISTM that the stuff you say is
> unreachable is only so because of non-essential behavioral choices made in
> other parts of the code. If we were to change those other parts later, this
> code (after patching) would break. I'd rather leave complete coverage here
> and not make fragile assumptions; especially so since these are presumably
> not performance-critical paths.

Ok, that's true for the branches handling packed toast chunks. I thought it
was better to throw an error rather than have silently accept something which
indicates something unexpected has happened. And it was just extra useless
code for readers to slog through.

The others I just put comments on In case the next person was as confused as I
was trying to figure out the logic. They're not especially performance
critical even though they're in the loop because they only get hit when we're
considering fields the first time.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Gregory Stark 2007-08-05 17:41:59 Re: pg_lzcompress strategy parameters
Previous Message Magnus Hagander 2007-08-05 17:05:08 Strange file in cvs repo

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2007-08-05 23:07:21 Re: pg_restore loops forever past EOF for corrupt custom archive files
Previous Message Chad Wagner 2007-08-05 17:18:36 Re: pg_restore loops forever past EOF for corrupt custom archive files