@@ -125,7 +125,7 @@ static void UpdateIndexRelation(Oid indexoid, Oid heapoid,
125
125
bool isvalid ,
126
126
bool isready );
127
127
static void index_update_stats (Relation rel ,
128
- bool hasindex , bool isprimary ,
128
+ bool hasindex ,
129
129
double reltuples );
130
130
static void IndexCheckExclusion (Relation heapRelation ,
131
131
Relation indexRelation ,
@@ -1162,7 +1162,6 @@ index_create(Relation heapRelation,
1162
1162
*/
1163
1163
index_update_stats (heapRelation ,
1164
1164
true,
1165
- isprimary ,
1166
1165
-1.0 );
1167
1166
/* Make the above update visible */
1168
1167
CommandCounterIncrement ();
@@ -1364,21 +1363,6 @@ index_constraint_create(Relation heapRelation,
1364
1363
InvalidOid , conOid , indexRelationId , true);
1365
1364
}
1366
1365
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
-
1382
1366
/*
1383
1367
* If needed, mark the index as primary and/or deferred in pg_index.
1384
1368
*
@@ -2041,7 +2025,6 @@ FormIndexDatum(IndexInfo *indexInfo,
2041
2025
* to ensure we can do all the necessary work in just one update.
2042
2026
*
2043
2027
* hasindex: set relhasindex to this value
2044
- * isprimary: if true, set relhaspkey true; else no change
2045
2028
* reltuples: if >= 0, set reltuples to this value; else no change
2046
2029
*
2047
2030
* If reltuples >= 0, relpages and relallvisible are also updated (using
@@ -2058,7 +2041,6 @@ FormIndexDatum(IndexInfo *indexInfo,
2058
2041
static void
2059
2042
index_update_stats (Relation rel ,
2060
2043
bool hasindex ,
2061
- bool isprimary ,
2062
2044
double reltuples )
2063
2045
{
2064
2046
Oid relid = RelationGetRelid (rel );
@@ -2088,7 +2070,7 @@ index_update_stats(Relation rel,
2088
2070
* It is safe to use a non-transactional update even though our
2089
2071
* transaction could still fail before committing. Setting relhasindex
2090
2072
* 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
2092
2074
* reltuples counts are correct regardless. However, we don't want to
2093
2075
* change relpages (or relallvisible) if the caller isn't providing an
2094
2076
* updated reltuples count, because that would bollix the
@@ -2140,14 +2122,6 @@ index_update_stats(Relation rel,
2140
2122
rd_rel -> relhasindex = hasindex ;
2141
2123
dirty = true;
2142
2124
}
2143
- if (isprimary )
2144
- {
2145
- if (!rd_rel -> relhaspkey )
2146
- {
2147
- rd_rel -> relhaspkey = true;
2148
- dirty = true;
2149
- }
2150
- }
2151
2125
2152
2126
if (reltuples >= 0 )
2153
2127
{
@@ -2356,11 +2330,9 @@ index_build(Relation heapRelation,
2356
2330
*/
2357
2331
index_update_stats (heapRelation ,
2358
2332
true,
2359
- isprimary ,
2360
2333
stats -> heap_tuples );
2361
2334
2362
2335
index_update_stats (indexRelation ,
2363
- false,
2364
2336
false,
2365
2337
stats -> index_tuples );
2366
2338
0 commit comments