mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-30 19:00:29 +08:00
Improve tab completion for BEGIN & START|SET TRANSACTION.
Andreas Karlsson with minor change by me for SET TRANSACTION SNAPSHOT.
This commit is contained in:
parent
6c03d981a6
commit
76f9dd4fa8
@ -1894,8 +1894,11 @@ psql_completion(const char *text, int start, int end)
|
||||
else if (Matches5("ALTER", "GROUP", MatchAny, "ADD|DROP", "USER"))
|
||||
COMPLETE_WITH_QUERY(Query_for_list_of_roles);
|
||||
|
||||
/* BEGIN, END, ABORT */
|
||||
else if (Matches1("BEGIN|END|ABORT"))
|
||||
/* BEGIN */
|
||||
else if (Matches1("BEGIN"))
|
||||
COMPLETE_WITH_LIST6("WORK", "TRANSACTION", "ISOLATION LEVEL", "READ", "DEFERRABLE", "NOT DEFERRABLE");
|
||||
/* END, ABORT */
|
||||
else if (Matches1("END|ABORT"))
|
||||
COMPLETE_WITH_LIST2("WORK", "TRANSACTION");
|
||||
/* COMMIT */
|
||||
else if (Matches1("COMMIT"))
|
||||
@ -2762,20 +2765,36 @@ psql_completion(const char *text, int start, int end)
|
||||
else if (Matches1("SHOW"))
|
||||
COMPLETE_WITH_QUERY(Query_for_list_of_show_vars);
|
||||
/* Complete "SET TRANSACTION" */
|
||||
else if (Matches2("SET|BEGIN|START", "TRANSACTION") ||
|
||||
else if (Matches2("SET", "TRANSACTION"))
|
||||
COMPLETE_WITH_LIST5("SNAPSHOT", "ISOLATION LEVEL", "READ", "DEFERRABLE", "NOT DEFERRABLE");
|
||||
else if (Matches2("BEGIN|START", "TRANSACTION") ||
|
||||
Matches2("BEGIN", "WORK") ||
|
||||
Matches1("BEGIN") ||
|
||||
Matches5("SET", "SESSION", "CHARACTERISTICS", "AS", "TRANSACTION"))
|
||||
COMPLETE_WITH_LIST2("ISOLATION LEVEL", "READ");
|
||||
COMPLETE_WITH_LIST4("ISOLATION LEVEL", "READ", "DEFERRABLE", "NOT DEFERRABLE");
|
||||
else if (Matches3("SET|BEGIN|START", "TRANSACTION|WORK", "NOT") ||
|
||||
Matches2("BEGIN", "NOT") ||
|
||||
Matches6("SET", "SESSION", "CHARACTERISTICS", "AS", "TRANSACTION", "NOT"))
|
||||
COMPLETE_WITH_CONST("DEFERRABLE");
|
||||
else if (Matches3("SET|BEGIN|START", "TRANSACTION|WORK", "ISOLATION") ||
|
||||
Matches2("BEGIN", "ISOLATION") ||
|
||||
Matches6("SET", "SESSION", "CHARACTERISTICS", "AS", "TRANSACTION", "ISOLATION"))
|
||||
COMPLETE_WITH_CONST("LEVEL");
|
||||
else if (Matches4("SET|BEGIN|START", "TRANSACTION|WORK", "ISOLATION", "LEVEL"))
|
||||
else if (Matches4("SET|BEGIN|START", "TRANSACTION|WORK", "ISOLATION", "LEVEL") ||
|
||||
Matches3("BEGIN", "ISOLATION", "LEVEL") ||
|
||||
Matches7("SET", "SESSION", "CHARACTERISTICS", "AS", "TRANSACTION", "ISOLATION", "LEVEL"))
|
||||
COMPLETE_WITH_LIST3("READ", "REPEATABLE READ", "SERIALIZABLE");
|
||||
else if (Matches5("SET|BEGIN|START", "TRANSACTION|WORK", "ISOLATION", "LEVEL", "READ"))
|
||||
else if (Matches5("SET|BEGIN|START", "TRANSACTION|WORK", "ISOLATION", "LEVEL", "READ") ||
|
||||
Matches4("BEGIN", "ISOLATION", "LEVEL", "READ") ||
|
||||
Matches8("SET", "SESSION", "CHARACTERISTICS", "AS", "TRANSACTION", "ISOLATION", "LEVEL", "READ"))
|
||||
COMPLETE_WITH_LIST2("UNCOMMITTED", "COMMITTED");
|
||||
else if (Matches5("SET|BEGIN|START", "TRANSACTION|WORK", "ISOLATION", "LEVEL", "REPEATABLE"))
|
||||
else if (Matches5("SET|BEGIN|START", "TRANSACTION|WORK", "ISOLATION", "LEVEL", "REPEATABLE") ||
|
||||
Matches4("BEGIN", "ISOLATION", "LEVEL", "REPEATABLE") ||
|
||||
Matches8("SET", "SESSION", "CHARACTERISTICS", "AS", "TRANSACTION", "ISOLATION", "LEVEL", "REPEATABLE"))
|
||||
COMPLETE_WITH_CONST("READ");
|
||||
else if (Matches3("SET|BEGIN|START", "TRANSACTION|WORK", "READ"))
|
||||
else if (Matches3("SET|BEGIN|START", "TRANSACTION|WORK", "READ") ||
|
||||
Matches2("BEGIN", "READ") ||
|
||||
Matches6("SET", "SESSION", "CHARACTERISTICS", "AS", "TRANSACTION", "READ"))
|
||||
COMPLETE_WITH_LIST2("ONLY", "WRITE");
|
||||
/* SET CONSTRAINTS */
|
||||
else if (Matches2("SET", "CONSTRAINTS"))
|
||||
|
Loading…
Reference in New Issue
Block a user