mirror of
https://github.com/postgres/postgres.git
synced 2025-07-15 19:21:59 +03:00
Tab completion for CREATE TABLESPACE arguments. Patch by Joachim Wieland.
This commit is contained in:
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 2000-2004, PostgreSQL Global Development Group
|
* Copyright (c) 2000-2004, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.116 2004/09/22 04:25:16 neilc Exp $
|
* $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.117 2004/11/02 16:10:05 petere Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
/*----------------------------------------------------------------------
|
||||||
@ -488,7 +488,8 @@ psql_completion(char *text, int start, int end)
|
|||||||
char *prev_wd,
|
char *prev_wd,
|
||||||
*prev2_wd,
|
*prev2_wd,
|
||||||
*prev3_wd,
|
*prev3_wd,
|
||||||
*prev4_wd;
|
*prev4_wd,
|
||||||
|
*prev5_wd;
|
||||||
|
|
||||||
static const char *const sql_commands[] = {
|
static const char *const sql_commands[] = {
|
||||||
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CHECKPOINT", "CLOSE", "CLUSTER", "COMMENT",
|
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CHECKPOINT", "CLOSE", "CLUSTER", "COMMENT",
|
||||||
@ -637,6 +638,7 @@ psql_completion(char *text, int start, int end)
|
|||||||
prev2_wd = previous_word(start, 1);
|
prev2_wd = previous_word(start, 1);
|
||||||
prev3_wd = previous_word(start, 2);
|
prev3_wd = previous_word(start, 2);
|
||||||
prev4_wd = previous_word(start, 3);
|
prev4_wd = previous_word(start, 3);
|
||||||
|
prev5_wd = previous_word(start, 4);
|
||||||
|
|
||||||
/* If a backslash command was started, continue */
|
/* If a backslash command was started, continue */
|
||||||
if (text[0] == '\\')
|
if (text[0] == '\\')
|
||||||
@ -1112,6 +1114,23 @@ psql_completion(char *text, int start, int end)
|
|||||||
pg_strcasecmp(prev_wd, "TEMP") == 0)
|
pg_strcasecmp(prev_wd, "TEMP") == 0)
|
||||||
COMPLETE_WITH_CONST("TABLE");
|
COMPLETE_WITH_CONST("TABLE");
|
||||||
|
|
||||||
|
/* CREATE TABLESPACE */
|
||||||
|
else if (pg_strcasecmp(prev3_wd, "CREATE") == 0 &&
|
||||||
|
pg_strcasecmp(prev2_wd, "TABLESPACE") == 0)
|
||||||
|
{
|
||||||
|
static const char *const list_CREATETABLESPACE[] =
|
||||||
|
{"OWNER", "LOCATION", NULL};
|
||||||
|
|
||||||
|
COMPLETE_WITH_LIST(list_CREATETABLESPACE);
|
||||||
|
}
|
||||||
|
/* Complete CREATE TABLESPACE name OWNER name with "LOCATION" */
|
||||||
|
else if (pg_strcasecmp(prev5_wd, "CREATE") == 0 &&
|
||||||
|
pg_strcasecmp(prev4_wd, "TABLESPACE") == 0 &&
|
||||||
|
pg_strcasecmp(prev2_wd, "OWNER") == 0)
|
||||||
|
{
|
||||||
|
COMPLETE_WITH_CONST("LOCATION");
|
||||||
|
}
|
||||||
|
|
||||||
/* CREATE TRIGGER */
|
/* CREATE TRIGGER */
|
||||||
/* is on the agenda . . . */
|
/* is on the agenda . . . */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user