aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2004-01-10 02:21:08 +0000
committerBruce Momjian <bruce@momjian.us>2004-01-10 02:21:08 +0000
commita620a760ed258a2004645ee87c9b98da71cf5266 (patch)
tree6e067e38748706424939df65f47868772019be89 /src
parente439fef6fc3e81aeb865f2c5a77c6faa2ee2a931 (diff)
downloadpostgresql-a620a760ed258a2004645ee87c9b98da71cf5266.tar.gz
postgresql-a620a760ed258a2004645ee87c9b98da71cf5266.zip
Allow BEGIN WORK to specify transaction isolation level, like START
TRANSACTION.
Diffstat (limited to 'src')
-rw-r--r--src/backend/parser/gram.y6
-rw-r--r--src/bin/psql/tab-complete.c22
2 files changed, 22 insertions, 6 deletions
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index fa7ba0ecde7..cd8c092a45f 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.443 2004/01/07 18:56:27 neilc Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.444 2004/01/10 02:21:08 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -3674,11 +3674,11 @@ TransactionStmt:
n->options = NIL;
$$ = (Node *)n;
}
- | BEGIN_P opt_transaction
+ | BEGIN_P opt_transaction transaction_mode_list_or_empty
{
TransactionStmt *n = makeNode(TransactionStmt);
n->kind = TRANS_STMT_BEGIN;
- n->options = NIL;
+ n->options = $3;
$$ = (Node *)n;
}
| START TRANSACTION transaction_mode_list_or_empty
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index 955e70deb8b..58ef84f9a52 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.97 2003/12/01 22:21:54 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.98 2004/01/10 02:21:08 momjian Exp $
*/
/*----------------------------------------------------------------------
@@ -723,6 +723,18 @@ psql_completion(char *text, int start, int end)
else if (strcasecmp(prev2_wd, "ANALYZE") == 0)
COMPLETE_WITH_CONST(";");
+/* BEGIN, COMMIT, ROLLBACK, ABORT, */
+ else if (strcasecmp(prev_wd, "BEGIN") == 0 ||
+ strcasecmp(prev_wd, "END") == 0 ||
+ strcasecmp(prev_wd, "COMMIT") == 0 ||
+ strcasecmp(prev_wd, "ROLLBACK") == 0 ||
+ strcasecmp(prev_wd, "ABORT") == 0)
+ {
+ static const char * const list_TRANS[] =
+ {"WORK", "TRANSACTION", NULL};
+
+ COMPLETE_WITH_LIST(list_TRANS);
+ }
/* CLUSTER */
/* If the previous word is CLUSTER, produce list of indexes. */
else if (strcasecmp(prev_wd, "CLUSTER") == 0)
@@ -1099,10 +1111,14 @@ psql_completion(char *text, int start, int end)
strcasecmp(prev_wd, "SHOW") == 0)
COMPLETE_WITH_LIST(pgsql_variables);
/* Complete "SET TRANSACTION" */
- else if ((strcasecmp(prev2_wd, "SET") == 0
- && strcasecmp(prev_wd, "TRANSACTION") == 0)
+ else if ((strcasecmp(prev2_wd, "SET") == 0 &&
+ strcasecmp(prev_wd, "TRANSACTION") == 0)
|| (strcasecmp(prev2_wd, "START") == 0
&& strcasecmp(prev_wd, "TRANSACTION") == 0)
+ || (strcasecmp(prev2_wd, "BEGIN") == 0
+ && strcasecmp(prev_wd, "WORK") == 0)
+ || (strcasecmp(prev2_wd, "BEGIN") == 0
+ && strcasecmp(prev_wd, "TRANSACTION") == 0)
|| (strcasecmp(prev4_wd, "SESSION") == 0
&& strcasecmp(prev3_wd, "CHARACTERISTICS") == 0
&& strcasecmp(prev2_wd, "AS") == 0