Re: Two aesthetic bugs in the 1-byte packed varlena code - Mailing list pgsql-patches

From Tom Lane
Subject Re: Two aesthetic bugs in the 1-byte packed varlena code
Date
Msg-id 23376.1181675557@sss.pgh.pa.us
Whole thread Raw
In response to Re: Two aesthetic bugs in the 1-byte packed varlena code  (Gregory Stark <stark@enterprisedb.com>)
List pgsql-patches
Gregory Stark <stark@enterprisedb.com> writes:
> "Tom Lane" <tgl@sss.pgh.pa.us> writes:
>> After looking closer, I think there are worse problems here: the code is
>> still using VARSIZE/VARDATA etc, which it should not be because the
>> field could easily be in 1-byte-header form.

> Well that's ok because VARATT_IS_EXTENDED returns true for 1-byte forms so
> it'll detoast them first.

Ah, right.

> We could avoid the detoasting but given that it's
> expecting the chunks to be compressed anyways the memcpys of the smallest
> chunks probably don't matter much either way. I'm assuming it's like toast in
> that only the last chunk will be smaller than LOBLKSIZE anyways, right?

Well, it's like toast except that there can be unwritten "holes" in a LO.
Still, in normal cases you'd expect only the last partial page to be
potentially short enough for 1-B format, and even then only about 1/16th
of the time.  OK, not worth changing then.

> There should never even be a null bitmap right? Maybe we should just
> elog(ERROR) if we find HeapTupleHasNulls(tuple) to be true at all.

That sounds like a good and cheap test.  Will make it so.

            regards, tom lane

pgsql-patches by date:

Previous
From: Gregory Stark
Date:
Subject: Re: Two aesthetic bugs in the 1-byte packed varlena code
Next
From: Andrew Dunstan
Date:
Subject: Re: [HACKERS] COPYable logs status