@@ -2439,10 +2439,10 @@ RelationDestroyRelation(Relation relation, bool remember_tupdesc)
2439
2439
list_free_deep (relation -> rd_fkeylist );
2440
2440
list_free (relation -> rd_indexlist );
2441
2441
list_free (relation -> rd_statlist );
2442
+ bms_free (relation -> rd_indexattr );
2442
2443
bms_free (relation -> rd_keyattr );
2443
2444
bms_free (relation -> rd_pkattr );
2444
2445
bms_free (relation -> rd_idattr );
2445
- bms_free (relation -> rd_hotblockingattr );
2446
2446
if (relation -> rd_pubdesc )
2447
2447
pfree (relation -> rd_pubdesc );
2448
2448
if (relation -> rd_options )
@@ -5104,10 +5104,10 @@ RelationGetIndexPredicate(Relation relation)
5104
5104
Bitmapset *
5105
5105
RelationGetIndexAttrBitmap (Relation relation , IndexAttrBitmapKind attrKind )
5106
5106
{
5107
+ Bitmapset * indexattrs ; /* indexed columns */
5107
5108
Bitmapset * uindexattrs ; /* columns in unique indexes */
5108
5109
Bitmapset * pkindexattrs ; /* columns in the primary index */
5109
5110
Bitmapset * idindexattrs ; /* columns in the replica identity */
5110
- Bitmapset * hotblockingattrs ; /* columns with HOT blocking indexes */
5111
5111
List * indexoidlist ;
5112
5112
List * newindexoidlist ;
5113
5113
Oid relpkindex ;
@@ -5116,18 +5116,18 @@ RelationGetIndexAttrBitmap(Relation relation, IndexAttrBitmapKind attrKind)
5116
5116
MemoryContext oldcxt ;
5117
5117
5118
5118
/* Quick exit if we already computed the result. */
5119
- if (relation -> rd_attrsvalid )
5119
+ if (relation -> rd_indexattr != NULL )
5120
5120
{
5121
5121
switch (attrKind )
5122
5122
{
5123
+ case INDEX_ATTR_BITMAP_ALL :
5124
+ return bms_copy (relation -> rd_indexattr );
5123
5125
case INDEX_ATTR_BITMAP_KEY :
5124
5126
return bms_copy (relation -> rd_keyattr );
5125
5127
case INDEX_ATTR_BITMAP_PRIMARY_KEY :
5126
5128
return bms_copy (relation -> rd_pkattr );
5127
5129
case INDEX_ATTR_BITMAP_IDENTITY_KEY :
5128
5130
return bms_copy (relation -> rd_idattr );
5129
- case INDEX_ATTR_BITMAP_HOT_BLOCKING :
5130
- return bms_copy (relation -> rd_hotblockingattr );
5131
5131
default :
5132
5132
elog (ERROR , "unknown attrKind %u" , attrKind );
5133
5133
}
@@ -5158,7 +5158,7 @@ RelationGetIndexAttrBitmap(Relation relation, IndexAttrBitmapKind attrKind)
5158
5158
relreplindex = relation -> rd_replidindex ;
5159
5159
5160
5160
/*
5161
- * For each index, add referenced attributes to appropriate bitmaps .
5161
+ * For each index, add referenced attributes to indexattrs .
5162
5162
*
5163
5163
* Note: we consider all indexes returned by RelationGetIndexList, even if
5164
5164
* they are not indisready or indisvalid. This is important because an
@@ -5167,10 +5167,10 @@ RelationGetIndexAttrBitmap(Relation relation, IndexAttrBitmapKind attrKind)
5167
5167
* CONCURRENTLY is far enough along that we should ignore the index, it
5168
5168
* won't be returned at all by RelationGetIndexList.
5169
5169
*/
5170
+ indexattrs = NULL ;
5170
5171
uindexattrs = NULL ;
5171
5172
pkindexattrs = NULL ;
5172
5173
idindexattrs = NULL ;
5173
- hotblockingattrs = NULL ;
5174
5174
foreach (l , indexoidlist )
5175
5175
{
5176
5176
Oid indexOid = lfirst_oid (l );
@@ -5235,9 +5235,8 @@ RelationGetIndexAttrBitmap(Relation relation, IndexAttrBitmapKind attrKind)
5235
5235
*/
5236
5236
if (attrnum != 0 )
5237
5237
{
5238
- if (indexDesc -> rd_indam -> amhotblocking )
5239
- hotblockingattrs = bms_add_member (hotblockingattrs ,
5240
- attrnum - FirstLowInvalidHeapAttributeNumber );
5238
+ indexattrs = bms_add_member (indexattrs ,
5239
+ attrnum - FirstLowInvalidHeapAttributeNumber );
5241
5240
5242
5241
if (isKey && i < indexDesc -> rd_index -> indnkeyatts )
5243
5242
uindexattrs = bms_add_member (uindexattrs ,
@@ -5254,15 +5253,10 @@ RelationGetIndexAttrBitmap(Relation relation, IndexAttrBitmapKind attrKind)
5254
5253
}
5255
5254
5256
5255
/* Collect all attributes used in expressions, too */
5257
- if (indexDesc -> rd_indam -> amhotblocking )
5258
- pull_varattnos (indexExpressions , 1 , & hotblockingattrs );
5256
+ pull_varattnos (indexExpressions , 1 , & indexattrs );
5259
5257
5260
- /*
5261
- * Collect all attributes in the index predicate, too. We have to
5262
- * ignore amhotblocking flag, because the row might become indexable,
5263
- * in which case we have to add it to the index.
5264
- */
5265
- pull_varattnos (indexPredicate , 1 , & hotblockingattrs );
5258
+ /* Collect all attributes in the index predicate, too */
5259
+ pull_varattnos (indexPredicate , 1 , & indexattrs );
5266
5260
5267
5261
index_close (indexDesc , AccessShareLock );
5268
5262
}
@@ -5290,46 +5284,46 @@ RelationGetIndexAttrBitmap(Relation relation, IndexAttrBitmapKind attrKind)
5290
5284
bms_free (uindexattrs );
5291
5285
bms_free (pkindexattrs );
5292
5286
bms_free (idindexattrs );
5293
- bms_free (hotblockingattrs );
5287
+ bms_free (indexattrs );
5294
5288
5295
5289
goto restart ;
5296
5290
}
5297
5291
5298
5292
/* Don't leak the old values of these bitmaps, if any */
5293
+ bms_free (relation -> rd_indexattr );
5294
+ relation -> rd_indexattr = NULL ;
5299
5295
bms_free (relation -> rd_keyattr );
5300
5296
relation -> rd_keyattr = NULL ;
5301
5297
bms_free (relation -> rd_pkattr );
5302
5298
relation -> rd_pkattr = NULL ;
5303
5299
bms_free (relation -> rd_idattr );
5304
5300
relation -> rd_idattr = NULL ;
5305
- bms_free (relation -> rd_hotblockingattr );
5306
- relation -> rd_hotblockingattr = NULL ;
5307
5301
5308
5302
/*
5309
5303
* Now save copies of the bitmaps in the relcache entry. We intentionally
5310
- * set rd_attrsvalid last, because that's what signals validity of the
5311
- * values; if we run out of memory before making that copy, we won't leave
5312
- * the relcache entry looking like the other ones are valid but empty.
5304
+ * set rd_indexattr last, because that's the one that signals validity of
5305
+ * the values; if we run out of memory before making that copy, we won't
5306
+ * leave the relcache entry looking like the other ones are valid but
5307
+ * empty.
5313
5308
*/
5314
5309
oldcxt = MemoryContextSwitchTo (CacheMemoryContext );
5315
5310
relation -> rd_keyattr = bms_copy (uindexattrs );
5316
5311
relation -> rd_pkattr = bms_copy (pkindexattrs );
5317
5312
relation -> rd_idattr = bms_copy (idindexattrs );
5318
- relation -> rd_hotblockingattr = bms_copy (hotblockingattrs );
5319
- relation -> rd_attrsvalid = true;
5313
+ relation -> rd_indexattr = bms_copy (indexattrs );
5320
5314
MemoryContextSwitchTo (oldcxt );
5321
5315
5322
5316
/* We return our original working copy for caller to play with */
5323
5317
switch (attrKind )
5324
5318
{
5319
+ case INDEX_ATTR_BITMAP_ALL :
5320
+ return indexattrs ;
5325
5321
case INDEX_ATTR_BITMAP_KEY :
5326
5322
return uindexattrs ;
5327
5323
case INDEX_ATTR_BITMAP_PRIMARY_KEY :
5328
5324
return pkindexattrs ;
5329
5325
case INDEX_ATTR_BITMAP_IDENTITY_KEY :
5330
5326
return idindexattrs ;
5331
- case INDEX_ATTR_BITMAP_HOT_BLOCKING :
5332
- return hotblockingattrs ;
5333
5327
default :
5334
5328
elog (ERROR , "unknown attrKind %u" , attrKind );
5335
5329
return NULL ;
@@ -6250,11 +6244,10 @@ load_relcache_init_file(bool shared)
6250
6244
rel -> rd_indexlist = NIL ;
6251
6245
rel -> rd_pkindex = InvalidOid ;
6252
6246
rel -> rd_replidindex = InvalidOid ;
6253
- rel -> rd_attrsvalid = false ;
6247
+ rel -> rd_indexattr = NULL ;
6254
6248
rel -> rd_keyattr = NULL ;
6255
6249
rel -> rd_pkattr = NULL ;
6256
6250
rel -> rd_idattr = NULL ;
6257
- rel -> rd_hotblockingattr = NULL ;
6258
6251
rel -> rd_pubdesc = NULL ;
6259
6252
rel -> rd_statvalid = false;
6260
6253
rel -> rd_statlist = NIL ;
0 commit comments