Remove argument isprimary from index_build()
authorMichael Paquier <[email protected]>
Wed, 23 Jan 2019 22:57:09 +0000 (07:57 +0900)
committerMichael Paquier <[email protected]>
Wed, 23 Jan 2019 22:57:09 +0000 (07:57 +0900)
The flag was introduced in 3fdeb18, but f66e8bf actually forgot to
finish the cleanup as index_update_stats() has simplified its
interface.

Author: Michael Paquier
Discussion: https://postgr.es/m/20190122080852[email protected]

src/backend/bootstrap/bootstrap.c
src/backend/catalog/heap.c
src/backend/catalog/index.c
src/backend/commands/indexcmds.c
src/include/catalog/index.h

index 6677926ae6ab0e7bb31fe9acd1f3c6103d34e069..4d7ed8ad1a77f2aafd44f25866d109319448f931 100644 (file)
@@ -1130,7 +1130,7 @@ build_indices(void)
        heap = table_open(ILHead->il_heap, NoLock);
        ind = index_open(ILHead->il_ind, NoLock);
 
-       index_build(heap, ind, ILHead->il_info, false, false, false);
+       index_build(heap, ind, ILHead->il_info, false, false);
 
        index_close(ind, NoLock);
        table_close(heap, NoLock);
index 1153688a1cd3abdf1e31d104ec9a4b936f777912..cc865de627d7ffab80855fd349db84c3234e1a31 100644 (file)
@@ -3063,7 +3063,7 @@ RelationTruncateIndexes(Relation heapRelation)
 
        /* Initialize the index and rebuild */
        /* Note: we do not need to re-establish pkey setting */
-       index_build(heapRelation, currentIndex, indexInfo, false, true, false);
+       index_build(heapRelation, currentIndex, indexInfo, true, false);
 
        /* We're done with this index */
        index_close(currentIndex, NoLock);
index 5ca0b1eb9698e32828b42845670e4ba4bd97a2f5..225c07801848d5d022be068504820c8f54e176ff 100644 (file)
@@ -1189,8 +1189,7 @@ index_create(Relation heapRelation,
    }
    else
    {
-       index_build(heapRelation, indexRelation, indexInfo, isprimary, false,
-                   true);
+       index_build(heapRelation, indexRelation, indexInfo, false, true);
    }
 
    /*
@@ -2220,13 +2219,9 @@ index_update_stats(Relation rel,
  * entries of the index and heap relation as needed, using statistics
  * returned by ambuild as well as data passed by the caller.
  *
- * isprimary tells whether to mark the index as a primary-key index.
  * isreindex indicates we are recreating a previously-existing index.
  * parallel indicates if parallelism may be useful.
  *
- * Note: when reindexing an existing index, isprimary can be false even if
- * the index is a PK; it's already properly marked and need not be re-marked.
- *
  * Note: before Postgres 8.2, the passed-in heap and index Relations
  * were automatically closed by this routine.  This is no longer the case.
  * The caller opened 'em, and the caller should close 'em.
@@ -2235,7 +2230,6 @@ void
 index_build(Relation heapRelation,
            Relation indexRelation,
            IndexInfo *indexInfo,
-           bool isprimary,
            bool isreindex,
            bool parallel)
 {
@@ -3702,7 +3696,7 @@ reindex_index(Oid indexId, bool skip_constraint_checks, char persistence,
 
        /* Initialize the index and rebuild */
        /* Note: we do not need to re-establish pkey setting */
-       index_build(heapRelation, iRel, indexInfo, false, true, true);
+       index_build(heapRelation, iRel, indexInfo, true, true);
    }
    PG_CATCH();
    {
index 3edc94308e80ac8279c62b670cfa2120a8c76aa7..5b2b8d2969494c9a763bd5b6832cd07c66d9abdb 100644 (file)
@@ -1168,7 +1168,7 @@ DefineIndex(Oid relationId,
    indexInfo->ii_BrokenHotChain = false;
 
    /* Now build the index */
-   index_build(rel, indexRelation, indexInfo, stmt->primary, false, true);
+   index_build(rel, indexRelation, indexInfo, false, true);
 
    /* Close both the relations, but keep the locks */
    table_close(rel, NoLock);
index 8daac5663cdc5edf4e8842f78632a9a9bdd1ded8..330c481a8b7a5496210397841288d7f450d20967 100644 (file)
@@ -107,7 +107,6 @@ extern void FormIndexDatum(IndexInfo *indexInfo,
 extern void index_build(Relation heapRelation,
            Relation indexRelation,
            IndexInfo *indexInfo,
-           bool isprimary,
            bool isreindex,
            bool parallel);