Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4171c44

Browse files
committed
Revert "Introduce CompactAttribute array in TupleDesc"
This reverts commitd28dff3.Quite a large number of buildfarm members didn't like this commit andit's not yet clear why. Reverting this before too many animals turnred.Discussion:https://postgr.es/m/CAApHDvr9i6T5=iAwQCxFDgMsthr_obVxgwBaEJkC8KUH6yM3Hw@mail.gmail.com
1 parentd28dff3 commit4171c44

File tree

14 files changed

+68
-246
lines changed

14 files changed

+68
-246
lines changed

‎src/backend/access/common/heaptuple.c

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,6 @@
8383
#defineVARLENA_ATT_IS_PACKABLE(att) \
8484
((att)->attstorage != TYPSTORAGE_PLAIN)
8585

86-
/* FormData_pg_attribute.attstorage != TYPSTORAGE_PLAIN and an attlen of -1 */
87-
#defineCOMPACT_ATTR_IS_PACKABLE(att) \
88-
((att)->attlen == -1 && (att)->attispackable)
89-
9086
/*
9187
* Setup for caching pass-by-ref missing attributes in a way that survives
9288
* tupleDesc destruction.
@@ -151,12 +147,12 @@ Datum
151147
getmissingattr(TupleDesctupleDesc,
152148
intattnum,bool*isnull)
153149
{
154-
CompactAttribute*att;
150+
Form_pg_attributeatt;
155151

156152
Assert(attnum <=tupleDesc->natts);
157153
Assert(attnum>0);
158154

159-
att=TupleDescCompactAttr(tupleDesc,attnum-1);
155+
att=TupleDescAttr(tupleDesc,attnum-1);
160156

161157
if (att->atthasmissing)
162158
{
@@ -227,15 +223,15 @@ heap_compute_data_size(TupleDesc tupleDesc,
227223
for (i=0;i<numberOfAttributes;i++)
228224
{
229225
Datumval;
230-
CompactAttribute*atti;
226+
Form_pg_attributeatti;
231227

232228
if (isnull[i])
233229
continue;
234230

235231
val=values[i];
236-
atti=TupleDescCompactAttr(tupleDesc,i);
232+
atti=TupleDescAttr(tupleDesc,i);
237233

238-
if (COMPACT_ATTR_IS_PACKABLE(atti)&&
234+
if (ATT_IS_PACKABLE(atti)&&
239235
VARATT_CAN_MAKE_SHORT(DatumGetPointer(val)))
240236
{
241237
/*
@@ -272,7 +268,7 @@ heap_compute_data_size(TupleDesc tupleDesc,
272268
* Fill in either a data value or a bit in the null bitmask
273269
*/
274270
staticinlinevoid
275-
fill_val(CompactAttribute*att,
271+
fill_val(Form_pg_attributeatt,
276272
bits8**bit,
277273
int*bitmask,
278274
char**dataP,
@@ -353,7 +349,8 @@ fill_val(CompactAttribute *att,
353349
data_length=VARSIZE_SHORT(val);
354350
memcpy(data,val,data_length);
355351
}
356-
elseif (att->attispackable&&VARATT_CAN_MAKE_SHORT(val))
352+
elseif (VARLENA_ATT_IS_PACKABLE(att)&&
353+
VARATT_CAN_MAKE_SHORT(val))
357354
{
358355
/* convert to short varlena -- no alignment */
359356
data_length=VARATT_CONVERTED_SHORT_SIZE(val);
@@ -430,7 +427,7 @@ heap_fill_tuple(TupleDesc tupleDesc,
430427

431428
for (i=0;i<numberOfAttributes;i++)
432429
{
433-
CompactAttribute*attr=TupleDescCompactAttr(tupleDesc,i);
430+
Form_pg_attributeattr=TupleDescAttr(tupleDesc,i);
434431

435432
fill_val(attr,
436433
bitP ?&bitP :NULL,
@@ -464,8 +461,7 @@ heap_attisnull(HeapTuple tup, int attnum, TupleDesc tupleDesc)
464461
Assert(!tupleDesc||attnum <=tupleDesc->natts);
465462
if (attnum> (int)HeapTupleHeaderGetNatts(tup->t_data))
466463
{
467-
if (tupleDesc&&
468-
TupleDescCompactAttr(tupleDesc,attnum-1)->atthasmissing)
464+
if (tupleDesc&&TupleDescAttr(tupleDesc,attnum-1)->atthasmissing)
469465
return false;
470466
else
471467
return true;
@@ -574,13 +570,13 @@ nocachegetattr(HeapTuple tup,
574570

575571
if (!slow)
576572
{
577-
CompactAttribute*att;
573+
Form_pg_attributeatt;
578574

579575
/*
580576
* If we get here, there are no nulls up to and including the target
581577
* attribute. If we have a cached offset, we can use it.
582578
*/
583-
att=TupleDescCompactAttr(tupleDesc,attnum);
579+
att=TupleDescAttr(tupleDesc,attnum);
584580
if (att->attcacheoff >=0)
585581
returnfetchatt(att,tp+att->attcacheoff);
586582

@@ -595,7 +591,7 @@ nocachegetattr(HeapTuple tup,
595591

596592
for (j=0;j <=attnum;j++)
597593
{
598-
if (TupleDescCompactAttr(tupleDesc,j)->attlen <=0)
594+
if (TupleDescAttr(tupleDesc,j)->attlen <=0)
599595
{
600596
slow= true;
601597
break;
@@ -618,18 +614,18 @@ nocachegetattr(HeapTuple tup,
618614
* fixed-width columns, in hope of avoiding future visits to this
619615
* routine.
620616
*/
621-
TupleDescCompactAttr(tupleDesc,0)->attcacheoff=0;
617+
TupleDescAttr(tupleDesc,0)->attcacheoff=0;
622618

623619
/* we might have set some offsets in the slow path previously */
624-
while (j<natts&&TupleDescCompactAttr(tupleDesc,j)->attcacheoff>0)
620+
while (j<natts&&TupleDescAttr(tupleDesc,j)->attcacheoff>0)
625621
j++;
626622

627-
off=TupleDescCompactAttr(tupleDesc,j-1)->attcacheoff+
628-
TupleDescCompactAttr(tupleDesc,j-1)->attlen;
623+
off=TupleDescAttr(tupleDesc,j-1)->attcacheoff+
624+
TupleDescAttr(tupleDesc,j-1)->attlen;
629625

630626
for (;j<natts;j++)
631627
{
632-
CompactAttribute*att=TupleDescCompactAttr(tupleDesc,j);
628+
Form_pg_attributeatt=TupleDescAttr(tupleDesc,j);
633629

634630
if (att->attlen <=0)
635631
break;
@@ -643,7 +639,7 @@ nocachegetattr(HeapTuple tup,
643639

644640
Assert(j>attnum);
645641

646-
off=TupleDescCompactAttr(tupleDesc,attnum)->attcacheoff;
642+
off=TupleDescAttr(tupleDesc,attnum)->attcacheoff;
647643
}
648644
else
649645
{
@@ -663,7 +659,7 @@ nocachegetattr(HeapTuple tup,
663659
off=0;
664660
for (i=0;;i++)/* loop exit is at "break" */
665661
{
666-
CompactAttribute*att=TupleDescCompactAttr(tupleDesc,i);
662+
Form_pg_attributeatt=TupleDescAttr(tupleDesc,i);
667663

668664
if (HeapTupleHasNulls(tup)&&att_isnull(i,bp))
669665
{
@@ -711,7 +707,7 @@ nocachegetattr(HeapTuple tup,
711707
}
712708
}
713709

714-
returnfetchatt(TupleDescCompactAttr(tupleDesc,attnum),tp+off);
710+
returnfetchatt(TupleDescAttr(tupleDesc,attnum),tp+off);
715711
}
716712

717713
/* ----------------
@@ -896,7 +892,7 @@ expand_tuple(HeapTuple *targetHeapTuple,
896892
{
897893
if (attrmiss[attnum].am_present)
898894
{
899-
CompactAttribute*att=TupleDescCompactAttr(tupleDesc,attnum);
895+
Form_pg_attributeatt=TupleDescAttr(tupleDesc,attnum);
900896

901897
targetDataLen=att_align_datum(targetDataLen,
902898
att->attalign,
@@ -1024,7 +1020,8 @@ expand_tuple(HeapTuple *targetHeapTuple,
10241020
/* Now fill in the missing values */
10251021
for (attnum=sourceNatts;attnum<natts;attnum++)
10261022
{
1027-
CompactAttribute*attr=TupleDescCompactAttr(tupleDesc,attnum);
1023+
1024+
Form_pg_attributeattr=TupleDescAttr(tupleDesc,attnum);
10281025

10291026
if (attrmiss&&attrmiss[attnum].am_present)
10301027
{
@@ -1373,7 +1370,7 @@ heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc,
13731370

13741371
for (attnum=0;attnum<natts;attnum++)
13751372
{
1376-
CompactAttribute*thisatt=TupleDescCompactAttr(tupleDesc,attnum);
1373+
Form_pg_attributethisatt=TupleDescAttr(tupleDesc,attnum);
13771374

13781375
if (hasnulls&&att_isnull(attnum,bp))
13791376
{

‎src/backend/access/common/indextuple.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -303,13 +303,13 @@ nocache_index_getattr(IndexTuple tup,
303303

304304
if (!slow)
305305
{
306-
CompactAttribute*att;
306+
Form_pg_attributeatt;
307307

308308
/*
309309
* If we get here, there are no nulls up to and including the target
310310
* attribute. If we have a cached offset, we can use it.
311311
*/
312-
att=TupleDescCompactAttr(tupleDesc,attnum);
312+
att=TupleDescAttr(tupleDesc,attnum);
313313
if (att->attcacheoff >=0)
314314
returnfetchatt(att,tp+att->attcacheoff);
315315

@@ -324,7 +324,7 @@ nocache_index_getattr(IndexTuple tup,
324324

325325
for (j=0;j <=attnum;j++)
326326
{
327-
if (TupleDescCompactAttr(tupleDesc,j)->attlen <=0)
327+
if (TupleDescAttr(tupleDesc,j)->attlen <=0)
328328
{
329329
slow= true;
330330
break;
@@ -347,18 +347,18 @@ nocache_index_getattr(IndexTuple tup,
347347
* fixed-width columns, in hope of avoiding future visits to this
348348
* routine.
349349
*/
350-
TupleDescCompactAttr(tupleDesc,0)->attcacheoff=0;
350+
TupleDescAttr(tupleDesc,0)->attcacheoff=0;
351351

352352
/* we might have set some offsets in the slow path previously */
353-
while (j<natts&&TupleDescCompactAttr(tupleDesc,j)->attcacheoff>0)
353+
while (j<natts&&TupleDescAttr(tupleDesc,j)->attcacheoff>0)
354354
j++;
355355

356-
off=TupleDescCompactAttr(tupleDesc,j-1)->attcacheoff+
357-
TupleDescCompactAttr(tupleDesc,j-1)->attlen;
356+
off=TupleDescAttr(tupleDesc,j-1)->attcacheoff+
357+
TupleDescAttr(tupleDesc,j-1)->attlen;
358358

359359
for (;j<natts;j++)
360360
{
361-
CompactAttribute*att=TupleDescCompactAttr(tupleDesc,j);
361+
Form_pg_attributeatt=TupleDescAttr(tupleDesc,j);
362362

363363
if (att->attlen <=0)
364364
break;
@@ -372,7 +372,7 @@ nocache_index_getattr(IndexTuple tup,
372372

373373
Assert(j>attnum);
374374

375-
off=TupleDescCompactAttr(tupleDesc,attnum)->attcacheoff;
375+
off=TupleDescAttr(tupleDesc,attnum)->attcacheoff;
376376
}
377377
else
378378
{
@@ -392,7 +392,7 @@ nocache_index_getattr(IndexTuple tup,
392392
off=0;
393393
for (i=0;;i++)/* loop exit is at "break" */
394394
{
395-
CompactAttribute*att=TupleDescCompactAttr(tupleDesc,i);
395+
Form_pg_attributeatt=TupleDescAttr(tupleDesc,i);
396396

397397
if (IndexTupleHasNulls(tup)&&att_isnull(i,bp))
398398
{
@@ -440,7 +440,7 @@ nocache_index_getattr(IndexTuple tup,
440440
}
441441
}
442442

443-
returnfetchatt(TupleDescCompactAttr(tupleDesc,attnum),tp+off);
443+
returnfetchatt(TupleDescAttr(tupleDesc,attnum),tp+off);
444444
}
445445

446446
/*
@@ -490,7 +490,7 @@ index_deform_tuple_internal(TupleDesc tupleDescriptor,
490490

491491
for (attnum=0;attnum<natts;attnum++)
492492
{
493-
CompactAttribute*thisatt=TupleDescCompactAttr(tupleDescriptor,attnum);
493+
Form_pg_attributethisatt=TupleDescAttr(tupleDescriptor,attnum);
494494

495495
if (hasnulls&&att_isnull(attnum,bp))
496496
{
@@ -588,7 +588,7 @@ index_truncate_tuple(TupleDesc sourceDescriptor, IndexTuple source,
588588
returnCopyIndexTuple(source);
589589

590590
/* Create temporary descriptor to scribble on */
591-
truncdesc=CreateTemplateTupleDesc(sourceDescriptor->natts);
591+
truncdesc=palloc(TupleDescSize(sourceDescriptor));
592592
TupleDescCopy(truncdesc,sourceDescriptor);
593593
truncdesc->natts=leavenatts;
594594

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp