@@ -96,10 +96,11 @@ static void UpdateIndexRelation(Oid indexoid, Oid heapoid,
96
96
Oid * classOids ,
97
97
int16 * coloptions ,
98
98
bool primary ,
99
+ bool isexclusion ,
99
100
bool immediate ,
100
101
bool isvalid );
101
102
static void index_update_stats (Relation rel ,
102
- bool hasindex , bool isprimary , bool hasexclusion ,
103
+ bool hasindex , bool isprimary ,
103
104
Oid reltoastidxid , double reltuples );
104
105
static void IndexCheckExclusion (Relation heapRelation ,
105
106
Relation indexRelation ,
@@ -523,6 +524,7 @@ UpdateIndexRelation(Oid indexoid,
523
524
Oid * classOids ,
524
525
int16 * coloptions ,
525
526
bool primary ,
527
+ bool isexclusion ,
526
528
bool immediate ,
527
529
bool isvalid )
528
530
{
@@ -591,6 +593,7 @@ UpdateIndexRelation(Oid indexoid,
591
593
values [Anum_pg_index_indnatts - 1 ] = Int16GetDatum (indexInfo -> ii_NumIndexAttrs );
592
594
values [Anum_pg_index_indisunique - 1 ] = BoolGetDatum (indexInfo -> ii_Unique );
593
595
values [Anum_pg_index_indisprimary - 1 ] = BoolGetDatum (primary );
596
+ values [Anum_pg_index_indisexclusion - 1 ] = BoolGetDatum (isexclusion );
594
597
values [Anum_pg_index_indimmediate - 1 ] = BoolGetDatum (immediate );
595
598
values [Anum_pg_index_indisclustered - 1 ] = BoolGetDatum (false);
596
599
values [Anum_pg_index_indisvalid - 1 ] = BoolGetDatum (isvalid );
@@ -819,7 +822,6 @@ index_create(Relation heapRelation,
819
822
indexRelation -> rd_rel -> relam = accessMethodObjectId ;
820
823
indexRelation -> rd_rel -> relkind = RELKIND_INDEX ;
821
824
indexRelation -> rd_rel -> relhasoids = false;
822
- indexRelation -> rd_rel -> relhasexclusion = is_exclusion ;
823
825
824
826
/*
825
827
* store index's pg_class entry
@@ -854,7 +856,7 @@ index_create(Relation heapRelation,
854
856
* ----------------
855
857
*/
856
858
UpdateIndexRelation (indexRelationId , heapRelationId , indexInfo ,
857
- classObjectId , coloptions , isprimary ,
859
+ classObjectId , coloptions , isprimary , is_exclusion ,
858
860
!deferrable ,
859
861
!concurrent );
860
862
@@ -1024,7 +1026,6 @@ index_create(Relation heapRelation,
1024
1026
index_update_stats (heapRelation ,
1025
1027
true,
1026
1028
isprimary ,
1027
- is_exclusion ,
1028
1029
InvalidOid ,
1029
1030
heapRelation -> rd_rel -> reltuples );
1030
1031
/* Make the above update visible */
@@ -1190,7 +1191,6 @@ index_constraint_create(Relation heapRelation,
1190
1191
index_update_stats (heapRelation ,
1191
1192
true,
1192
1193
true,
1193
- false,
1194
1194
InvalidOid ,
1195
1195
heapRelation -> rd_rel -> reltuples );
1196
1196
@@ -1375,7 +1375,7 @@ BuildIndexInfo(Relation index)
1375
1375
ii -> ii_PredicateState = NIL ;
1376
1376
1377
1377
/* fetch exclusion constraint info if any */
1378
- if (index -> rd_rel -> relhasexclusion )
1378
+ if (indexStruct -> indisexclusion )
1379
1379
{
1380
1380
RelationGetExclusionInfo (index ,
1381
1381
& ii -> ii_ExclusionOps ,
@@ -1486,7 +1486,6 @@ FormIndexDatum(IndexInfo *indexInfo,
1486
1486
*
1487
1487
* hasindex: set relhasindex to this value
1488
1488
* isprimary: if true, set relhaspkey true; else no change
1489
- * hasexclusion: if true, set relhasexclusion true; else no change
1490
1489
* reltoastidxid: if not InvalidOid, set reltoastidxid to this value;
1491
1490
* else no change
1492
1491
* reltuples: set reltuples to this value
@@ -1503,7 +1502,7 @@ FormIndexDatum(IndexInfo *indexInfo,
1503
1502
*/
1504
1503
static void
1505
1504
index_update_stats (Relation rel ,
1506
- bool hasindex , bool isprimary , bool hasexclusion ,
1505
+ bool hasindex , bool isprimary ,
1507
1506
Oid reltoastidxid , double reltuples )
1508
1507
{
1509
1508
BlockNumber relpages = RelationGetNumberOfBlocks (rel );
@@ -1542,9 +1541,9 @@ index_update_stats(Relation rel,
1542
1541
* It is safe to use a non-transactional update even though our
1543
1542
* transaction could still fail before committing. Setting relhasindex
1544
1543
* true is safe even if there are no indexes (VACUUM will eventually fix
1545
- * it), likewise for relhaspkey and relhasexclusion . And of course the
1546
- * relpages and reltuples counts are correct (or at least more so than the
1547
- * old values) regardless.
1544
+ * it), likewise for relhaspkey. And of course the relpages and reltuples
1545
+ * counts are correct (or at least more so than the old values)
1546
+ * regardless.
1548
1547
*/
1549
1548
1550
1549
pg_class = heap_open (RelationRelationId , RowExclusiveLock );
@@ -1597,14 +1596,6 @@ index_update_stats(Relation rel,
1597
1596
dirty = true;
1598
1597
}
1599
1598
}
1600
- if (hasexclusion )
1601
- {
1602
- if (!rd_rel -> relhasexclusion )
1603
- {
1604
- rd_rel -> relhasexclusion = true;
1605
- dirty = true;
1606
- }
1607
- }
1608
1599
if (OidIsValid (reltoastidxid ))
1609
1600
{
1610
1601
Assert (rd_rel -> relkind == RELKIND_TOASTVALUE );
@@ -1760,13 +1751,11 @@ index_build(Relation heapRelation,
1760
1751
index_update_stats (heapRelation ,
1761
1752
true,
1762
1753
isprimary ,
1763
- (indexInfo -> ii_ExclusionOps != NULL ),
1764
1754
(heapRelation -> rd_rel -> relkind == RELKIND_TOASTVALUE ) ?
1765
1755
RelationGetRelid (indexRelation ) : InvalidOid ,
1766
1756
stats -> heap_tuples );
1767
1757
1768
1758
index_update_stats (indexRelation ,
1769
- false,
1770
1759
false,
1771
1760
false,
1772
1761
InvalidOid ,
0 commit comments