1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-22 12:22:45 +03:00

Revert "Introduce CompactAttribute array in TupleDesc"

This reverts commit d28dff3f6c.

Quite a large number of buildfarm members didn't like this commit and
it's not yet clear why.  Reverting this before too many animals turn
red.

Discussion: https://postgr.es/m/CAApHDvr9i6T5=iAwQCxFDgMsthr_obVxgwBaEJkC8KUH6yM3Hw@mail.gmail.com
This commit is contained in:
David Rowley
2024-12-03 17:12:38 +13:00
parent d28dff3f6c
commit 4171c44c9b
14 changed files with 68 additions and 246 deletions

View File

@@ -303,13 +303,13 @@ nocache_index_getattr(IndexTuple tup,
if (!slow)
{
CompactAttribute *att;
Form_pg_attribute att;
/*
* If we get here, there are no nulls up to and including the target
* attribute. If we have a cached offset, we can use it.
*/
att = TupleDescCompactAttr(tupleDesc, attnum);
att = TupleDescAttr(tupleDesc, attnum);
if (att->attcacheoff >= 0)
return fetchatt(att, tp + att->attcacheoff);
@@ -324,7 +324,7 @@ nocache_index_getattr(IndexTuple tup,
for (j = 0; j <= attnum; j++)
{
if (TupleDescCompactAttr(tupleDesc, j)->attlen <= 0)
if (TupleDescAttr(tupleDesc, j)->attlen <= 0)
{
slow = true;
break;
@@ -347,18 +347,18 @@ nocache_index_getattr(IndexTuple tup,
* fixed-width columns, in hope of avoiding future visits to this
* routine.
*/
TupleDescCompactAttr(tupleDesc, 0)->attcacheoff = 0;
TupleDescAttr(tupleDesc, 0)->attcacheoff = 0;
/* we might have set some offsets in the slow path previously */
while (j < natts && TupleDescCompactAttr(tupleDesc, j)->attcacheoff > 0)
while (j < natts && TupleDescAttr(tupleDesc, j)->attcacheoff > 0)
j++;
off = TupleDescCompactAttr(tupleDesc, j - 1)->attcacheoff +
TupleDescCompactAttr(tupleDesc, j - 1)->attlen;
off = TupleDescAttr(tupleDesc, j - 1)->attcacheoff +
TupleDescAttr(tupleDesc, j - 1)->attlen;
for (; j < natts; j++)
{
CompactAttribute *att = TupleDescCompactAttr(tupleDesc, j);
Form_pg_attribute att = TupleDescAttr(tupleDesc, j);
if (att->attlen <= 0)
break;
@@ -372,7 +372,7 @@ nocache_index_getattr(IndexTuple tup,
Assert(j > attnum);
off = TupleDescCompactAttr(tupleDesc, attnum)->attcacheoff;
off = TupleDescAttr(tupleDesc, attnum)->attcacheoff;
}
else
{
@@ -392,7 +392,7 @@ nocache_index_getattr(IndexTuple tup,
off = 0;
for (i = 0;; i++) /* loop exit is at "break" */
{
CompactAttribute *att = TupleDescCompactAttr(tupleDesc, i);
Form_pg_attribute att = TupleDescAttr(tupleDesc, i);
if (IndexTupleHasNulls(tup) && att_isnull(i, bp))
{
@@ -440,7 +440,7 @@ nocache_index_getattr(IndexTuple tup,
}
}
return fetchatt(TupleDescCompactAttr(tupleDesc, attnum), tp + off);
return fetchatt(TupleDescAttr(tupleDesc, attnum), tp + off);
}
/*
@@ -490,7 +490,7 @@ index_deform_tuple_internal(TupleDesc tupleDescriptor,
for (attnum = 0; attnum < natts; attnum++)
{
CompactAttribute *thisatt = TupleDescCompactAttr(tupleDescriptor, attnum);
Form_pg_attribute thisatt = TupleDescAttr(tupleDescriptor, attnum);
if (hasnulls && att_isnull(attnum, bp))
{
@@ -588,7 +588,7 @@ index_truncate_tuple(TupleDesc sourceDescriptor, IndexTuple source,
return CopyIndexTuple(source);
/* Create temporary descriptor to scribble on */
truncdesc = CreateTemplateTupleDesc(sourceDescriptor->natts);
truncdesc = palloc(TupleDescSize(sourceDescriptor));
TupleDescCopy(truncdesc, sourceDescriptor);
truncdesc->natts = leavenatts;