@@ -96,10 +96,11 @@ static void UpdateIndexRelation(Oid indexoid, Oid heapoid,
9696 Oid * classOids ,
9797 int16 * coloptions ,
9898 bool primary ,
99+ bool isexclusion ,
99100 bool immediate ,
100101 bool isvalid );
101102static void index_update_stats (Relation rel ,
102- bool hasindex , bool isprimary , bool hasexclusion ,
103+ bool hasindex , bool isprimary ,
103104 Oid reltoastidxid , double reltuples );
104105static void IndexCheckExclusion (Relation heapRelation ,
105106 Relation indexRelation ,
@@ -523,6 +524,7 @@ UpdateIndexRelation(Oid indexoid,
523524 Oid * classOids ,
524525 int16 * coloptions ,
525526 bool primary ,
527+ bool isexclusion ,
526528 bool immediate ,
527529 bool isvalid )
528530{
@@ -591,6 +593,7 @@ UpdateIndexRelation(Oid indexoid,
591593 values [Anum_pg_index_indnatts - 1 ] = Int16GetDatum (indexInfo -> ii_NumIndexAttrs );
592594 values [Anum_pg_index_indisunique - 1 ] = BoolGetDatum (indexInfo -> ii_Unique );
593595 values [Anum_pg_index_indisprimary - 1 ] = BoolGetDatum (primary );
596+ values [Anum_pg_index_indisexclusion - 1 ] = BoolGetDatum (isexclusion );
594597 values [Anum_pg_index_indimmediate - 1 ] = BoolGetDatum (immediate );
595598 values [Anum_pg_index_indisclustered - 1 ] = BoolGetDatum (false);
596599 values [Anum_pg_index_indisvalid - 1 ] = BoolGetDatum (isvalid );
@@ -819,7 +822,6 @@ index_create(Relation heapRelation,
819822 indexRelation -> rd_rel -> relam = accessMethodObjectId ;
820823 indexRelation -> rd_rel -> relkind = RELKIND_INDEX ;
821824 indexRelation -> rd_rel -> relhasoids = false;
822- indexRelation -> rd_rel -> relhasexclusion = is_exclusion ;
823825
824826 /*
825827 * store index's pg_class entry
@@ -854,7 +856,7 @@ index_create(Relation heapRelation,
854856 * ----------------
855857 */
856858 UpdateIndexRelation (indexRelationId , heapRelationId , indexInfo ,
857- classObjectId , coloptions , isprimary ,
859+ classObjectId , coloptions , isprimary , is_exclusion ,
858860 !deferrable ,
859861 !concurrent );
860862
@@ -1024,7 +1026,6 @@ index_create(Relation heapRelation,
10241026 index_update_stats (heapRelation ,
10251027 true,
10261028 isprimary ,
1027- is_exclusion ,
10281029 InvalidOid ,
10291030 heapRelation -> rd_rel -> reltuples );
10301031 /* Make the above update visible */
@@ -1190,7 +1191,6 @@ index_constraint_create(Relation heapRelation,
11901191 index_update_stats (heapRelation ,
11911192 true,
11921193 true,
1193- false,
11941194 InvalidOid ,
11951195 heapRelation -> rd_rel -> reltuples );
11961196
@@ -1375,7 +1375,7 @@ BuildIndexInfo(Relation index)
13751375 ii -> ii_PredicateState = NIL ;
13761376
13771377 /* fetch exclusion constraint info if any */
1378- if (index -> rd_rel -> relhasexclusion )
1378+ if (indexStruct -> indisexclusion )
13791379 {
13801380 RelationGetExclusionInfo (index ,
13811381 & ii -> ii_ExclusionOps ,
@@ -1486,7 +1486,6 @@ FormIndexDatum(IndexInfo *indexInfo,
14861486 *
14871487 * hasindex: set relhasindex to this value
14881488 * isprimary: if true, set relhaspkey true; else no change
1489- * hasexclusion: if true, set relhasexclusion true; else no change
14901489 * reltoastidxid: if not InvalidOid, set reltoastidxid to this value;
14911490 * else no change
14921491 * reltuples: set reltuples to this value
@@ -1503,7 +1502,7 @@ FormIndexDatum(IndexInfo *indexInfo,
15031502 */
15041503static void
15051504index_update_stats (Relation rel ,
1506- bool hasindex , bool isprimary , bool hasexclusion ,
1505+ bool hasindex , bool isprimary ,
15071506 Oid reltoastidxid , double reltuples )
15081507{
15091508 BlockNumber relpages = RelationGetNumberOfBlocks (rel );
@@ -1542,9 +1541,9 @@ index_update_stats(Relation rel,
15421541 * It is safe to use a non-transactional update even though our
15431542 * transaction could still fail before committing. Setting relhasindex
15441543 * 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.
15481547 */
15491548
15501549 pg_class = heap_open (RelationRelationId , RowExclusiveLock );
@@ -1597,14 +1596,6 @@ index_update_stats(Relation rel,
15971596 dirty = true;
15981597 }
15991598 }
1600- if (hasexclusion )
1601- {
1602- if (!rd_rel -> relhasexclusion )
1603- {
1604- rd_rel -> relhasexclusion = true;
1605- dirty = true;
1606- }
1607- }
16081599 if (OidIsValid (reltoastidxid ))
16091600 {
16101601 Assert (rd_rel -> relkind == RELKIND_TOASTVALUE );
@@ -1760,13 +1751,11 @@ index_build(Relation heapRelation,
17601751 index_update_stats (heapRelation ,
17611752 true,
17621753 isprimary ,
1763- (indexInfo -> ii_ExclusionOps != NULL ),
17641754 (heapRelation -> rd_rel -> relkind == RELKIND_TOASTVALUE ) ?
17651755 RelationGetRelid (indexRelation ) : InvalidOid ,
17661756 stats -> heap_tuples );
17671757
17681758 index_update_stats (indexRelation ,
1769- false,
17701759 false,
17711760 false,
17721761 InvalidOid ,
0 commit comments