aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorItagaki Takahiro <itagaki.takahiro@gmail.com>2010-02-15 02:55:01 +0000
committerItagaki Takahiro <itagaki.takahiro@gmail.com>2010-02-15 02:55:01 +0000
commit714f279457de23cbc81efc6961f4b5d611723db6 (patch)
tree7ac1448ae50492ad292f8a006e71fcc79e2921fd /src
parent34ebccddcd234df7b4f25d6dd6355a886c831edb (diff)
downloadpostgresql-714f279457de23cbc81efc6961f4b5d611723db6.tar.gz
postgresql-714f279457de23cbc81efc6961f4b5d611723db6.zip
Add psql tab completion for DO blocks.
Also adjust documentation of DO. Patch from David Fetter and subsequent discussion.
Diffstat (limited to 'src')
-rw-r--r--src/bin/psql/tab-complete.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index cecd88d522a..19b9b1f3ef5 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2010, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.192 2010/01/25 18:23:09 heikki Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.193 2010/02/15 02:55:01 itagaki Exp $
*/
/*----------------------------------------------------------------------
@@ -618,7 +618,7 @@ psql_completion(char *text, int start, int end)
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CHECKPOINT", "CLOSE", "CLUSTER",
"COMMENT", "COMMIT", "COPY", "CREATE", "DEALLOCATE", "DECLARE",
- "DELETE FROM", "DISCARD", "DROP", "END", "EXECUTE", "EXPLAIN", "FETCH",
+ "DELETE FROM", "DISCARD", "DO", "DROP", "END", "EXECUTE", "EXPLAIN", "FETCH",
"GRANT", "INSERT", "LISTEN", "LOAD", "LOCK", "MOVE", "NOTIFY", "PREPARE",
"REASSIGN", "REINDEX", "RELEASE", "RESET", "REVOKE", "ROLLBACK",
"SAVEPOINT", "SELECT", "SET", "SHOW", "START", "TABLE", "TRUNCATE", "UNLISTEN",
@@ -1532,6 +1532,18 @@ psql_completion(char *text, int start, int end)
COMPLETE_WITH_LIST(list_DISCARD);
}
+/* DO */
+ /*
+ * Complete DO with LANGUAGE.
+ */
+ else if (pg_strcasecmp(prev_wd, "DO") == 0)
+ {
+ static const char *const list_DO[] =
+ {"LANGUAGE", NULL};
+
+ COMPLETE_WITH_LIST(list_DO);
+ }
+
/* DROP (when not the previous word) */
/* DROP AGGREGATE */
else if (pg_strcasecmp(prev3_wd, "DROP") == 0 &&