Skip to content

Commit ef85f5f

Browse files
committed
Add tab completion syntax for PREPARE 2-phase commit syntax.
There's no tab-completion for "PREPARE TRANSACTION 'xxx'" since that would be ambigous with "PREPARE xxx AS xx". Heikki Linnakangas
1 parent a4ca842 commit ef85f5f

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/bin/psql/tab-complete.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.134 2005/07/23 21:05:47 tgl Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.135 2005/07/28 22:14:30 momjian Exp $
77
*/
88

99
/*----------------------------------------------------------------------
@@ -927,16 +927,23 @@ psql_completion(char *text, int start, int end)
927927
pg_strcasecmp(prev_wd, "USER") == 0)
928928
COMPLETE_WITH_QUERY(Query_for_list_of_users);
929929

930-
/* BEGIN, END, COMMIT, ABORT */
930+
/* BEGIN, END, ABORT */
931931
else if (pg_strcasecmp(prev_wd, "BEGIN") == 0 ||
932932
pg_strcasecmp(prev_wd, "END") == 0 ||
933-
pg_strcasecmp(prev_wd, "COMMIT") == 0 ||
934933
pg_strcasecmp(prev_wd, "ABORT") == 0)
935934
{
936935
static const char *const list_TRANS[] =
937936
{"WORK", "TRANSACTION", NULL};
938937

939938
COMPLETE_WITH_LIST(list_TRANS);
939+
}
940+
/* COMMIT */
941+
else if(pg_strcasecmp(prev_wd, "COMMIT") == 0)
942+
{
943+
static const char *const list_COMMIT[] =
944+
{"WORK", "TRANSACTION", "PREPARED", NULL};
945+
946+
COMPLETE_WITH_LIST(list_COMMIT);
940947
}
941948
/* RELEASE SAVEPOINT */
942949
else if (pg_strcasecmp(prev_wd, "RELEASE") == 0)
@@ -945,7 +952,7 @@ psql_completion(char *text, int start, int end)
945952
else if (pg_strcasecmp(prev_wd, "ROLLBACK") == 0)
946953
{
947954
static const char *const list_TRANS[] =
948-
{"WORK", "TRANSACTION", "TO SAVEPOINT", NULL};
955+
{"WORK", "TRANSACTION", "TO SAVEPOINT", "PREPARED", NULL};
949956

950957
COMPLETE_WITH_LIST(list_TRANS);
951958
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy