summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorTom Lane2005-06-22 21:14:31 +0000
committerTom Lane2005-06-22 21:14:31 +0000
commit4cc7a93d220644ae068ce2639b961db6764a68f6 (patch)
tree85002f8f6887221d98d16dcbdc120246baf6b090 /src/bin
parente98edb5555de0197ba4ffc99b4f3db134c99a86f (diff)
Make REINDEX DATABASE do what one would expect, namely reindex all indexes
in the database. The old behavior (reindex system catalogs only) is now available as REINDEX SYSTEM. I did not add the complementary REINDEX USER case since there did not seem to be consensus for this, but it would be trivial to add later. Per recent discussions.
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/psql/common.c10
-rw-r--r--src/bin/psql/tab-complete.c9
2 files changed, 11 insertions, 8 deletions
diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c
index fed2275f469..741eb45f851 100644
--- a/src/bin/psql/common.c
+++ b/src/bin/psql/common.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.103 2005/06/17 22:32:47 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.104 2005/06/22 21:14:30 tgl Exp $
*/
#include "postgres_fe.h"
#include "common.h"
@@ -1246,9 +1246,9 @@ command_no_begin(const char *query)
return true;
/*
- * Note: these tests will match REINDEX TABLESPACE, which isn't really
- * a valid command so we don't care much. The other five possible
- * matches are correct.
+ * Note: these tests will match CREATE SYSTEM, DROP SYSTEM, and
+ * REINDEX TABLESPACE, which aren't really valid commands so we don't
+ * care much. The other six possible matches are correct.
*/
if ((wordlen == 6 && pg_strncasecmp(query, "create", 6) == 0) ||
(wordlen == 4 && pg_strncasecmp(query, "drop", 4) == 0) ||
@@ -1264,6 +1264,8 @@ command_no_begin(const char *query)
if (wordlen == 8 && pg_strncasecmp(query, "database", 8) == 0)
return true;
+ if (wordlen == 6 && pg_strncasecmp(query, "system", 6) == 0)
+ return true;
if (wordlen == 10 && pg_strncasecmp(query, "tablespace", 10) == 0)
return true;
}
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 4700cc79bda..648ccadd4f6 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.132 2005/06/21 00:48:33 neilc Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.133 2005/06/22 21:14:30 tgl Exp $
*/
/*----------------------------------------------------------------------
@@ -1456,7 +1456,7 @@ psql_completion(char *text, int start, int end)
else if (pg_strcasecmp(prev_wd, "REINDEX") == 0)
{
static const char *const list_REINDEX[] =
- {"TABLE", "DATABASE", "INDEX", NULL};
+ {"TABLE", "INDEX", "SYSTEM", "DATABASE", NULL};
COMPLETE_WITH_LIST(list_REINDEX);
}
@@ -1464,10 +1464,11 @@ psql_completion(char *text, int start, int end)
{
if (pg_strcasecmp(prev_wd, "TABLE") == 0)
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables, NULL);
- else if (pg_strcasecmp(prev_wd, "DATABASE") == 0)
- COMPLETE_WITH_QUERY(Query_for_list_of_databases);
else if (pg_strcasecmp(prev_wd, "INDEX") == 0)
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_indexes, NULL);
+ else if (pg_strcasecmp(prev_wd, "SYSTEM") == 0 ||
+ pg_strcasecmp(prev_wd, "DATABASE") == 0)
+ COMPLETE_WITH_QUERY(Query_for_list_of_databases);
}
/* SELECT */