diff options
Diffstat (limited to 'src/backend/tcop')
-rw-r--r-- | src/backend/tcop/postgres.c | 15 | ||||
-rw-r--r-- | src/backend/tcop/utility.c | 57 |
2 files changed, 68 insertions, 4 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 123d70af9b4..77422deb386 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.141 2000/01/26 05:57:07 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.142 2000/02/18 09:29:27 inoue Exp $ * * NOTES * this is the "main" module of the postgres backend and @@ -963,7 +963,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[]) optind = 1; /* reset after postmaster's usage */ while ((flag = getopt(argc, argv, - "A:B:CD:d:EeFf:iK:LNOo:p:QS:sT:t:v:W:x:")) + "A:B:CD:d:EeFf:iK:LNOPo:p:QS:sT:t:v:W:x:")) != EOF) switch (flag) { @@ -1116,6 +1116,15 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[]) allowSystemTableMods = true; break; + case 'P': + /* -------------------- + * ignore system indexes + * -------------------- + */ + if (secure) /* XXX safe to allow from client??? */ + IgnoreSystemIndexes(true); + break; + case 'o': /* ---------------- * o - send output (stdout and stderr) to the given file @@ -1516,7 +1525,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[]) if (!IsUnderPostmaster) { puts("\nPOSTGRES backend interactive interface "); - puts("$Revision: 1.141 $ $Date: 2000/01/26 05:57:07 $\n"); + puts("$Revision: 1.142 $ $Date: 2000/02/18 09:29:27 $\n"); } /* diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c index 66acb230f2e..427bf7b4d41 100644 --- a/src/backend/tcop/utility.c +++ b/src/backend/tcop/utility.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.82 2000/01/29 16:58:38 petere Exp $ + * $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.83 2000/02/18 09:29:31 inoue Exp $ * *------------------------------------------------------------------------- */ @@ -846,6 +846,61 @@ ProcessUtility(Node *parsetree, DropGroup((DropGroupStmt *) parsetree); break; + case T_ReindexStmt: + { + ReindexStmt *stmt = (ReindexStmt *) parsetree; + + PS_SET_STATUS(commandTag = "REINDEX"); + CHECK_IF_ABORTED(); + + switch (stmt->reindexType) + { + case INDEX: + relname = stmt->name; + if (IsSystemRelationName(relname)) + { + if (!allowSystemTableMods && IsSystemRelationName(relname)) + elog(ERROR, "class \"%s\" is a system catalog index", + relname); + if (!IsIgnoringSystemIndexes()) + elog(ERROR, "class \"%s\" is a system catalog index", + relname); + } +#ifndef NO_SECURITY + if (!pg_ownercheck(userName, relname, RELNAME)) + elog(ERROR, "%s: %s", relname, aclcheck_error_strings[ACLCHECK_NOT_OWNER]); +#endif + ReindexIndex(relname, stmt->force); + break; + case TABLE: + relname = stmt->name; + if (IsSystemRelationName(relname)) + { + if (!allowSystemTableMods && IsSystemRelationName(relname)) + elog(ERROR, "class \"%s\" is a system catalog index", + relname); + if (!IsIgnoringSystemIndexes()) + elog(ERROR, "class \"%s\" is a system catalog index", + relname); + } +#ifndef NO_SECURITY + if (!pg_ownercheck(userName, relname, RELNAME)) + elog(ERROR, "%s: %s", relname, aclcheck_error_strings[ACLCHECK_NOT_OWNER]); +#endif + ReindexTable(relname, stmt->force); + break; + case DATABASE: + relname = stmt->name; + if (!allowSystemTableMods) + elog(ERROR, "-O option is needed"); + if (!IsIgnoringSystemIndexes()) + elog(ERROR, "-P option is needed"); + ReindexDatabase(relname, stmt->force, false); + break; + } + break; + } + break; /* * ******************************** default ******************************** * |