|
3 | 3 | *
|
4 | 4 | * Copyright (c) 2000-2004, PostgreSQL Global Development Group
|
5 | 5 | *
|
6 |
| - * $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.116 2004/09/22 04:25:16 neilc Exp $ |
| 6 | + * $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.117 2004/11/02 16:10:05 petere Exp $ |
7 | 7 | */
|
8 | 8 |
|
9 | 9 | /*----------------------------------------------------------------------
|
@@ -488,7 +488,8 @@ psql_completion(char *text, int start, int end)
|
488 | 488 | char *prev_wd,
|
489 | 489 | *prev2_wd,
|
490 | 490 | *prev3_wd,
|
491 |
| - *prev4_wd; |
| 491 | + *prev4_wd, |
| 492 | + *prev5_wd; |
492 | 493 |
|
493 | 494 | static const char *const sql_commands[] = {
|
494 | 495 | "ABORT", "ALTER", "ANALYZE", "BEGIN", "CHECKPOINT", "CLOSE", "CLUSTER", "COMMENT",
|
@@ -637,6 +638,7 @@ psql_completion(char *text, int start, int end)
|
637 | 638 | prev2_wd = previous_word(start, 1);
|
638 | 639 | prev3_wd = previous_word(start, 2);
|
639 | 640 | prev4_wd = previous_word(start, 3);
|
| 641 | + prev5_wd = previous_word(start, 4); |
640 | 642 |
|
641 | 643 | /* If a backslash command was started, continue */
|
642 | 644 | if (text[0] == '\\')
|
@@ -766,14 +768,14 @@ psql_completion(char *text, int start, int end)
|
766 | 768 | {
|
767 | 769 | static const char *const list_ALTERSCHEMA2[] =
|
768 | 770 | {"MINVALUE", "MAXVALUE", "CYCLE", NULL};
|
769 |
| - |
| 771 | + |
770 | 772 | COMPLETE_WITH_LIST(list_ALTERSCHEMA2);
|
771 | 773 | }
|
772 | 774 | /* ALTER TRIGGER <name>, add ON */
|
773 | 775 | else if (pg_strcasecmp(prev3_wd, "ALTER") == 0 &&
|
774 | 776 | pg_strcasecmp(prev2_wd, "TRIGGER") == 0)
|
775 | 777 | COMPLETE_WITH_CONST("ON");
|
776 |
| - |
| 778 | + |
777 | 779 | else if (pg_strcasecmp(prev4_wd, "ALTER") == 0 &&
|
778 | 780 | pg_strcasecmp(prev3_wd, "TRIGGER") == 0)
|
779 | 781 | {
|
@@ -1004,7 +1006,7 @@ psql_completion(char *text, int start, int end)
|
1004 | 1006 | {
|
1005 | 1007 | static const char *const list_FROMTO[] =
|
1006 | 1008 | {"FROM", "TO", NULL};
|
1007 |
| - |
| 1009 | + |
1008 | 1010 | COMPLETE_WITH_LIST(list_FROMTO);
|
1009 | 1011 | }
|
1010 | 1012 | /* If we have COPY|BINARY <sth> FROM|TO, complete with filename */
|
@@ -1112,6 +1114,23 @@ psql_completion(char *text, int start, int end)
|
1112 | 1114 | pg_strcasecmp(prev_wd, "TEMP") == 0)
|
1113 | 1115 | COMPLETE_WITH_CONST("TABLE");
|
1114 | 1116 |
|
| 1117 | +/* CREATE TABLESPACE */ |
| 1118 | + else if (pg_strcasecmp(prev3_wd, "CREATE") == 0 && |
| 1119 | + pg_strcasecmp(prev2_wd, "TABLESPACE") == 0) |
| 1120 | + { |
| 1121 | + static const char *const list_CREATETABLESPACE[] = |
| 1122 | + {"OWNER", "LOCATION", NULL}; |
| 1123 | + |
| 1124 | + COMPLETE_WITH_LIST(list_CREATETABLESPACE); |
| 1125 | + } |
| 1126 | + /* Complete CREATE TABLESPACE name OWNER name with "LOCATION" */ |
| 1127 | + else if (pg_strcasecmp(prev5_wd, "CREATE") == 0 && |
| 1128 | + pg_strcasecmp(prev4_wd, "TABLESPACE") == 0 && |
| 1129 | + pg_strcasecmp(prev2_wd, "OWNER") == 0) |
| 1130 | + { |
| 1131 | + COMPLETE_WITH_CONST("LOCATION"); |
| 1132 | + } |
| 1133 | + |
1115 | 1134 | /* CREATE TRIGGER */
|
1116 | 1135 | /* is on the agenda . . . */
|
1117 | 1136 |
|
|
0 commit comments