Commit bc1088c2 authored by Tom Lane's avatar Tom Lane

Get rid of bogus use of heap_mark4update in reindex operations (cf.

recent bug report).  Fix processing of nailed-in-cache indexes;
it appears that REINDEX DATABASE has been broken for months :-(.
parent df3e7b3a
This diff is collapsed.
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.89 2002/09/19 23:40:56 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.90 2002/09/23 00:42:48 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -110,7 +110,7 @@ DefineIndex(RangeVar *heapRelation, ...@@ -110,7 +110,7 @@ DefineIndex(RangeVar *heapRelation,
if (!IsBootstrapProcessingMode() && if (!IsBootstrapProcessingMode() &&
IsSystemRelation(rel) && IsSystemRelation(rel) &&
!IndexesAreActive(relationId, false)) !IndexesAreActive(rel))
elog(ERROR, "Existing indexes are inactive. REINDEX first"); elog(ERROR, "Existing indexes are inactive. REINDEX first");
heap_close(rel, NoLock); heap_close(rel, NoLock);
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.238 2002/09/20 19:56:01 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.239 2002/09/23 00:42:48 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -894,7 +894,7 @@ full_vacuum_rel(Relation onerel, VacuumStmt *vacstmt) ...@@ -894,7 +894,7 @@ full_vacuum_rel(Relation onerel, VacuumStmt *vacstmt)
{ {
vac_close_indexes(nindexes, Irel); vac_close_indexes(nindexes, Irel);
Irel = (Relation *) NULL; Irel = (Relation *) NULL;
activate_indexes_of_a_table(RelationGetRelid(onerel), false); activate_indexes_of_a_table(onerel, false);
} }
#endif /* NOT_USED */ #endif /* NOT_USED */
...@@ -947,7 +947,7 @@ full_vacuum_rel(Relation onerel, VacuumStmt *vacstmt) ...@@ -947,7 +947,7 @@ full_vacuum_rel(Relation onerel, VacuumStmt *vacstmt)
#ifdef NOT_USED #ifdef NOT_USED
if (reindex) if (reindex)
activate_indexes_of_a_table(RelationGetRelid(onerel), true); activate_indexes_of_a_table(onerel, true);
#endif /* NOT_USED */ #endif /* NOT_USED */
/* update shared free space map with final free space info */ /* update shared free space map with final free space info */
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: index.h,v 1.49 2002/07/12 18:43:19 tgl Exp $ * $Id: index.h,v 1.50 2002/09/23 00:42:48 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -50,7 +50,7 @@ extern void FormIndexDatum(IndexInfo *indexInfo, ...@@ -50,7 +50,7 @@ extern void FormIndexDatum(IndexInfo *indexInfo,
char *nullv); char *nullv);
extern void UpdateStats(Oid relid, double reltuples); extern void UpdateStats(Oid relid, double reltuples);
extern bool IndexesAreActive(Oid relid, bool comfirmCommitted); extern bool IndexesAreActive(Relation heaprel);
extern void setRelhasindex(Oid relid, bool hasindex, extern void setRelhasindex(Oid relid, bool hasindex,
bool isprimary, Oid reltoastidxid); bool isprimary, Oid reltoastidxid);
...@@ -68,8 +68,9 @@ extern double IndexBuildHeapScan(Relation heapRelation, ...@@ -68,8 +68,9 @@ extern double IndexBuildHeapScan(Relation heapRelation,
IndexBuildCallback callback, IndexBuildCallback callback,
void *callback_state); void *callback_state);
extern bool activate_indexes_of_a_table(Relation heaprel, bool activate);
extern bool reindex_index(Oid indexId, bool force, bool inplace); extern bool reindex_index(Oid indexId, bool force, bool inplace);
extern bool activate_indexes_of_a_table(Oid relid, bool activate);
extern bool reindex_relation(Oid relid, bool force); extern bool reindex_relation(Oid relid, bool force);
#endif /* INDEX_H */ #endif /* INDEX_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment