@@ -125,7 +125,7 @@ static void UpdateIndexRelation(Oid indexoid, Oid heapoid,
125125 bool isvalid ,
126126 bool isready );
127127static void index_update_stats (Relation rel ,
128- bool hasindex , bool isprimary ,
128+ bool hasindex ,
129129 double reltuples );
130130static void IndexCheckExclusion (Relation heapRelation ,
131131 Relation indexRelation ,
@@ -1162,7 +1162,6 @@ index_create(Relation heapRelation,
11621162 */
11631163 index_update_stats (heapRelation ,
11641164 true,
1165- isprimary ,
11661165 -1.0 );
11671166 /* Make the above update visible */
11681167 CommandCounterIncrement ();
@@ -1364,21 +1363,6 @@ index_constraint_create(Relation heapRelation,
13641363 InvalidOid , conOid , indexRelationId , true);
13651364 }
13661365
1367- /*
1368- * If needed, mark the table as having a primary key. We assume it can't
1369- * have been so marked already, so no need to clear the flag in the other
1370- * case.
1371- *
1372- * Note: this might better be done by callers. We do it here to avoid
1373- * exposing index_update_stats() globally, but that wouldn't be necessary
1374- * if relhaspkey went away.
1375- */
1376- if (mark_as_primary )
1377- index_update_stats (heapRelation ,
1378- true,
1379- true,
1380- -1.0 );
1381-
13821366 /*
13831367 * If needed, mark the index as primary and/or deferred in pg_index.
13841368 *
@@ -2041,7 +2025,6 @@ FormIndexDatum(IndexInfo *indexInfo,
20412025 * to ensure we can do all the necessary work in just one update.
20422026 *
20432027 * hasindex: set relhasindex to this value
2044- * isprimary: if true, set relhaspkey true; else no change
20452028 * reltuples: if >= 0, set reltuples to this value; else no change
20462029 *
20472030 * If reltuples >= 0, relpages and relallvisible are also updated (using
@@ -2058,7 +2041,6 @@ FormIndexDatum(IndexInfo *indexInfo,
20582041static void
20592042index_update_stats (Relation rel ,
20602043 bool hasindex ,
2061- bool isprimary ,
20622044 double reltuples )
20632045{
20642046 Oid relid = RelationGetRelid (rel );
@@ -2088,7 +2070,7 @@ index_update_stats(Relation rel,
20882070 * It is safe to use a non-transactional update even though our
20892071 * transaction could still fail before committing. Setting relhasindex
20902072 * true is safe even if there are no indexes (VACUUM will eventually fix
2091- * it), likewise for relhaspkey . And of course the new relpages and
2073+ * it). And of course the new relpages and
20922074 * reltuples counts are correct regardless. However, we don't want to
20932075 * change relpages (or relallvisible) if the caller isn't providing an
20942076 * updated reltuples count, because that would bollix the
@@ -2140,14 +2122,6 @@ index_update_stats(Relation rel,
21402122 rd_rel -> relhasindex = hasindex ;
21412123 dirty = true;
21422124 }
2143- if (isprimary )
2144- {
2145- if (!rd_rel -> relhaspkey )
2146- {
2147- rd_rel -> relhaspkey = true;
2148- dirty = true;
2149- }
2150- }
21512125
21522126 if (reltuples >= 0 )
21532127 {
@@ -2356,11 +2330,9 @@ index_build(Relation heapRelation,
23562330 */
23572331 index_update_stats (heapRelation ,
23582332 true,
2359- isprimary ,
23602333 stats -> heap_tuples );
23612334
23622335 index_update_stats (indexRelation ,
2363- false,
23642336 false,
23652337 stats -> index_tuples );
23662338
0 commit comments