mirror of
https://github.com/postgres/postgres.git
synced 2025-06-23 14:01:44 +03:00
Putting back the previous change must be the first thing.
ALso put back a #ifndef ENABLE_REINDEX_NAILED_RELATIONS which was removed about a year ago.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.107 2003/09/19 19:57:42 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.108 2003/09/23 01:51:09 inoue Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -658,41 +658,17 @@ void
|
||||
ReindexTable(RangeVar *relation, bool force)
|
||||
{
|
||||
Oid heapOid;
|
||||
HeapTuple tuple;
|
||||
char relkind;
|
||||
|
||||
heapOid = RangeVarGetRelid(relation, false);
|
||||
tuple = SearchSysCache(RELOID,
|
||||
ObjectIdGetDatum(heapOid),
|
||||
0, 0, 0);
|
||||
if (!HeapTupleIsValid(tuple)) /* shouldn't happen */
|
||||
elog(ERROR, "cache lookup failed for relation %u", heapOid);
|
||||
relkind = get_rel_relkind(heapOid);
|
||||
|
||||
if (((Form_pg_class) GETSTRUCT(tuple))->relkind != RELKIND_RELATION &&
|
||||
((Form_pg_class) GETSTRUCT(tuple))->relkind != RELKIND_TOASTVALUE)
|
||||
if (relkind != RELKIND_RELATION && relkind != RELKIND_TOASTVALUE)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||
errmsg("relation \"%s\" is not a table",
|
||||
relation->relname)));
|
||||
|
||||
if (IsSystemClass((Form_pg_class) GETSTRUCT(tuple)) &&
|
||||
!IsToastClass((Form_pg_class) GETSTRUCT(tuple)))
|
||||
{
|
||||
if (!allowSystemTableMods)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||
errmsg("permission denied: \"%s\" is a system table",
|
||||
relation->relname),
|
||||
errhint("Do REINDEX in standalone postgres with -O -P options.")));
|
||||
if (!IsIgnoringSystemIndexes())
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||
errmsg("permission denied: \"%s\" is a system table",
|
||||
relation->relname),
|
||||
errhint("Do REINDEX in standalone postgres with -P -O options.")));
|
||||
}
|
||||
|
||||
ReleaseSysCache(tuple);
|
||||
|
||||
/*
|
||||
* In-place REINDEX within a transaction block is dangerous, because
|
||||
* if the transaction is later rolled back we have no way to undo
|
||||
|
Reference in New Issue
Block a user