errdetail("Index \"%s\" is associated with temporary relation.",
RelationGetRelationName(rel))));
- if (!IndexIsValid(rel->rd_index))
+ if (!rel->rd_index->indisvalid)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot check index \"%s\"",
elog(ERROR, "cache lookup failed for index %u", indexoid);
index = (Form_pg_index) GETSTRUCT(indexTuple);
/* we're only interested if it is the primary key and valid */
- if (index->indisprimary && IndexIsValid(index))
+ if (index->indisprimary && index->indisvalid)
{
int indnkeyatts = index->indnkeyatts;
for (i = 0; i < num_indexes; i++)
{
/* Only index relations marked as ready can be updated */
- if (IndexIsReady(toastidxs[i]->rd_index))
+ if (toastidxs[i]->rd_index->indisready)
index_insert(toastidxs[i], t_values, t_isnull,
&(toasttup->t_self),
toastrel,
*
* Caller must have suitable lock on the relation.
*
- * Note: we intentionally do not check IndexIsValid here; that's because this
+ * Note: we intentionally do not check indisvalid here; that's because this
* is used to enforce the rule that there can be only one indisprimary index,
* and we want that to be true even if said index is invalid.
*/
/* other info */
ii->ii_Unique = indexStruct->indisunique;
- ii->ii_ReadyForInserts = IndexIsReady(indexStruct);
+ ii->ii_ReadyForInserts = indexStruct->indisready;
/* assume not doing speculative insertion for now */
ii->ii_UniqueOps = NULL;
ii->ii_UniqueProcs = NULL;
* might put recently-dead tuples out-of-order in the new table, and there
* is little harm in that.)
*/
- if (!IndexIsValid(OldIndex->rd_index))
+ if (!OldIndex->rd_index->indisvalid)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot cluster on invalid index \"%s\"",
else if (thisIndexOid == indexOid)
{
/* this was checked earlier, but let's be real sure */
- if (!IndexIsValid(indexForm))
+ if (!indexForm->indisvalid)
elog(ERROR, "cannot cluster on invalid index %u", indexOid);
indexForm->indisclustered = true;
CatalogTupleUpdate(pg_index, &indexTuple->t_self, indexTuple);
*/
if (!(heap_attisnull(tuple, Anum_pg_index_indpred, NULL) &&
heap_attisnull(tuple, Anum_pg_index_indexprs, NULL) &&
- IndexIsValid(indexForm)))
+ indexForm->indisvalid))
{
ReleaseSysCache(tuple);
return false;
ConstraintSetParentConstraint(cldConstrOid,
createdConstraintId);
- if (!IndexIsValid(cldidx->rd_index))
+ if (!cldidx->rd_index->indisvalid)
invalidate_parent = true;
found = true;
if (indexStruct->indisunique &&
indexStruct->indimmediate &&
indexRel->rd_rel->relam == BTREE_AM_OID &&
- IndexIsValid(indexStruct) &&
+ indexStruct->indisvalid &&
RelationGetIndexPredicate(indexRel) == NIL &&
indexStruct->indnatts > 0)
{
if (!HeapTupleIsValid(indexTuple))
elog(ERROR, "cache lookup failed for index %u", indexoid);
indexStruct = (Form_pg_index) GETSTRUCT(indexTuple);
- if (indexStruct->indisprimary && IndexIsValid(indexStruct))
+ if (indexStruct->indisprimary && indexStruct->indisvalid)
{
/*
* Refuse to use a deferrable primary key. This is per SQL spec,
*/
if (indexStruct->indnkeyatts == numattrs &&
indexStruct->indisunique &&
- IndexIsValid(indexStruct) &&
+ indexStruct->indisvalid &&
heap_attisnull(indexTuple, Anum_pg_index_indpred, NULL) &&
heap_attisnull(indexTuple, Anum_pg_index_indexprs, NULL))
{
errmsg("cannot use partial index \"%s\" as replica identity",
RelationGetRelationName(indexRel))));
/* And neither are invalid indexes. */
- if (!IndexIsValid(indexRel->rd_index))
+ if (!indexRel->rd_index->indisvalid)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot use invalid index \"%s\" as replica identity",
elog(ERROR, "cache lookup failed for index %u",
inhForm->inhrelid);
indexForm = (Form_pg_index) GETSTRUCT(indTup);
- if (IndexIsValid(indexForm))
+ if (indexForm->indisvalid)
tuples += 1;
ReleaseSysCache(indTup);
}
* specified kind of lock on each. Return an array of Relation pointers for
* the indexes into *Irel, and the number of indexes into *nindexes.
*
- * We consider an index vacuumable if it is marked insertable (IndexIsReady).
+ * We consider an index vacuumable if it is marked insertable (indisready).
* If it isn't, probably a CREATE INDEX CONCURRENTLY command failed early in
* execution, and what we have is too corrupt to be processable. We will
* vacuum even if the index isn't indisvalid; this is important because in a
Relation indrel;
indrel = index_open(indexoid, lockmode);
- if (IndexIsReady(indrel->rd_index))
+ if (indrel->rd_index->indisready)
(*Irel)[i++] = indrel;
else
index_close(indrel, lockmode);
* For each index, open the index relation and save pg_index info. We
* acquire RowExclusiveLock, signifying we will update the index.
*
- * Note: we do this even if the index is not IndexIsReady; it's not worth
+ * Note: we do this even if the index is not indisready; it's not worth
* the trouble to optimize for the case where it isn't.
*/
i = 0;
* queries. Note that this is OK because the data structure we
* are constructing is only used by the planner --- the executor
* still needs to insert into "invalid" indexes, if they're marked
- * IndexIsReady.
+ * indisready.
*/
- if (!IndexIsValid(index))
+ if (!index->indisvalid)
{
index_close(indexRelation, NoLock);
continue;
idxRel = index_open(indexoid, RowExclusiveLock);
idxForm = idxRel->rd_index;
- if (!IndexIsValid(idxForm))
+ if (!idxForm->indisvalid)
goto next;
/*
index_name, RelationGetRelationName(heap_rel)),
parser_errposition(cxt->pstate, constraint->location)));
- if (!IndexIsValid(index_form))
+ if (!index_form->indisvalid)
ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("index \"%s\" is not valid", index_name),
* so that we must recompute the index list on next request. This handles
* creation or deletion of an index.
*
- * Indexes that are marked not IndexIsLive are omitted from the returned list.
+ * Indexes that are marked not indislive are omitted from the returned list.
* Such indexes are expected to be dropped momentarily, and should not be
* touched at all by any caller of this function.
*
* HOT-safety decisions. It's unsafe to touch such an index at all
* since its catalog entries could disappear at any instant.
*/
- if (!IndexIsLive(index))
+ if (!index->indislive)
continue;
/* Add index's OID to result list in the proper order */
* interesting for either oid indexes or replication identity indexes,
* so don't check them.
*/
- if (!IndexIsValid(index) || !index->indisunique ||
+ if (!index->indisvalid || !index->indisunique ||
!index->indimmediate ||
!heap_attisnull(htup, Anum_pg_index_indpred, NULL))
continue;
#endif /* EXPOSE_TO_CLIENT_CODE */
-/*
- * Use of these macros is recommended over direct examination of the state
- * flag columns where possible; this allows source code compatibility with
- * the hacky representation used in 9.2.
- */
-#define IndexIsValid(indexForm) ((indexForm)->indisvalid)
-#define IndexIsReady(indexForm) ((indexForm)->indisready)
-#define IndexIsLive(indexForm) ((indexForm)->indislive)
-
#endif /* PG_INDEX_H */