1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +03:00

Add psql tab completion for DO blocks.

Also adjust documentation of DO.

Patch from David Fetter and subsequent discussion.
This commit is contained in:
Itagaki Takahiro
2010-02-15 02:55:01 +00:00
parent 34ebccddcd
commit 714f279457
2 changed files with 16 additions and 4 deletions

View File

@ -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 &&