aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser
diff options
context:
space:
mode:
authorHiroshi Inoue <inoue@tpf.co.jp>2000-02-18 09:30:20 +0000
committerHiroshi Inoue <inoue@tpf.co.jp>2000-02-18 09:30:20 +0000
commite3a97b370c2671c05ad95d6a21914c225a0cf32d (patch)
treee20b8bdc9dfedef71dfe1367c3b957cbf16c42c1 /src/backend/parser
parente3befe4a66c68fea03300eadb9d9b2f1c2534dc6 (diff)
downloadpostgresql-e3a97b370c2671c05ad95d6a21914c225a0cf32d.tar.gz
postgresql-e3a97b370c2671c05ad95d6a21914c225a0cf32d.zip
Implement reindex command
Diffstat (limited to 'src/backend/parser')
-rw-r--r--src/backend/parser/gram.y42
-rw-r--r--src/backend/parser/keywords.c4
2 files changed, 39 insertions, 7 deletions
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 4babad9524a..b6962f8fad6 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.143 2000/02/16 17:24:36 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.144 2000/02/18 09:29:40 inoue Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -124,7 +124,7 @@ static Node *doNegate(Node *n);
ExtendStmt, FetchStmt, GrantStmt, CreateTrigStmt, DropTrigStmt,
CreatePLangStmt, DropPLangStmt,
IndexStmt, ListenStmt, UnlistenStmt, LockStmt, OptimizableStmt,
- ProcedureStmt, RemoveAggrStmt, RemoveOperStmt,
+ ProcedureStmt, ReindexStmt, RemoveAggrStmt, RemoveOperStmt,
RemoveFuncStmt, RemoveStmt,
RenameStmt, RevokeStmt, RuleStmt, TransactionStmt, ViewStmt, LoadStmt,
CreatedbStmt, DropdbStmt, VacuumStmt, CursorStmt, SubSelect,
@@ -141,7 +141,7 @@ static Node *doNegate(Node *n);
%type <ival> createdb_opt_encoding
%type <ival> opt_lock, lock_type
-%type <boolean> opt_lmode
+%type <boolean> opt_lmode, opt_force
%type <ival> user_createdb_clause, user_createuser_clause
%type <str> user_passwd_clause
@@ -211,7 +211,7 @@ static Node *doNegate(Node *n);
opt_with_copy, index_opt_unique, opt_verbose, opt_analyze
%type <boolean> opt_cursor
-%type <ival> copy_dirn, def_type, direction, remove_type,
+%type <ival> copy_dirn, def_type, direction, reindex_type, remove_type,
opt_column, event, comment_type, comment_cl,
comment_ag, comment_fn, comment_op, comment_tg
@@ -339,13 +339,13 @@ static Node *doNegate(Node *n);
CACHE, CLUSTER, COMMENT, COPY, CREATEDB, CREATEUSER, CYCLE,
DATABASE, DELIMITERS, DO,
EACH, ENCODING, EXCLUSIVE, EXPLAIN, EXTEND,
- FORWARD, FUNCTION, HANDLER,
+ FORCE, FORWARD, FUNCTION, HANDLER,
INCREMENT, INDEX, INHERITS, INSTEAD, ISNULL,
LANCOMPILER, LIMIT, LISTEN, LOAD, LOCATION, LOCK_P,
MAXVALUE, MINVALUE, MODE, MOVE,
NEW, NOCREATEDB, NOCREATEUSER, NONE, NOTHING, NOTIFY, NOTNULL,
OFFSET, OIDS, OPERATOR, PASSWORD, PROCEDURAL,
- RENAME, RESET, RETURNS, ROW, RULE,
+ REINDEX, RENAME, RESET, RETURNS, ROW, RULE,
SEQUENCE, SERIAL, SETOF, SHARE, SHOW, START, STATEMENT, STDIN, STDOUT, SYSID,
TRUNCATE, TRUSTED,
UNLISTEN, UNTIL, VACUUM, VALID, VERBOSE, VERSION
@@ -440,6 +440,7 @@ stmt : AlterTableStmt
| UnlistenStmt
| LockStmt
| ProcedureStmt
+ | ReindexStmt
| RemoveAggrStmt
| RemoveOperStmt
| RemoveFuncStmt
@@ -2448,6 +2449,35 @@ oper_argtypes: name
/*****************************************************************************
*
* QUERY:
+ *
+ * REINDEX type <typename> [FORCE] [ALL]
+ *
+ *****************************************************************************/
+
+ReindexStmt: REINDEX reindex_type name opt_force
+ {
+ ReindexStmt *n = makeNode(ReindexStmt);
+ if (IsTransactionBlock())
+ elog(ERROR,"REINDEX command could only be used outside begin/end transaction blocks");
+ n->reindexType = $2;
+ n->name = $3;
+ n->force = $4;
+ $$ = (Node *)n;
+ }
+ ;
+
+reindex_type: INDEX { $$ = INDEX; }
+ | TABLE { $$ = TABLE; }
+ | DATABASE { $$ = DATABASE; }
+ ;
+opt_force: FORCE { $$ = TRUE; }
+ | /* EMPTY */ { $$ = FALSE; }
+ ;
+
+
+/*****************************************************************************
+ *
+ * QUERY:
* rename <attrname1> in <relname> [*] to <attrname2>
* rename <relname1> to <relname2>
*
diff --git a/src/backend/parser/keywords.c b/src/backend/parser/keywords.c
index e1c9424e37a..d971e95762d 100644
--- a/src/backend/parser/keywords.c
+++ b/src/backend/parser/keywords.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.66 2000/02/15 03:26:38 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.67 2000/02/18 09:29:40 inoue Exp $
*
*-------------------------------------------------------------------------
*/
@@ -107,6 +107,7 @@ static ScanKeyword ScanKeywords[] = {
{"fetch", FETCH},
{"float", FLOAT},
{"for", FOR},
+ {"force", FORCE},
{"foreign", FOREIGN},
{"forward", FORWARD},
{"from", FROM},
@@ -196,6 +197,7 @@ static ScanKeyword ScanKeywords[] = {
{"public", PUBLIC},
{"read", READ},
{"references", REFERENCES},
+ {"reindex", REINDEX},
{"relative", RELATIVE},
{"rename", RENAME},
{"reset", RESET},