Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita620a76

Browse files
committed
Allow BEGIN WORK to specify transaction isolation level, like START
TRANSACTION.
1 parente439fef commita620a76

File tree

4 files changed

+41
-11
lines changed

4 files changed

+41
-11
lines changed

‎doc/src/sgml/ref/begin.sgml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/begin.sgml,v 1.27 2003/11/29 19:51:38 pgsql Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/begin.sgml,v 1.28 2004/01/10 02:21:08 momjian Exp $
33
PostgreSQL documentation
44
-->
55

@@ -21,6 +21,8 @@ PostgreSQL documentation
2121
<refsynopsisdiv>
2222
<synopsis>
2323
BEGIN [ WORK | TRANSACTION ]
24+
[ ISOLATION LEVEL { READ UNCOMMITTED | READ COMMITTED | REPEATABLE READ | SERIALIZABLE } ]
25+
[ READ WRITE | READ ONLY ]
2426
</synopsis>
2527
</refsynopsisdiv>
2628

@@ -49,6 +51,13 @@ BEGIN [ WORK | TRANSACTION ]
4951
other sessions will be unable to see the intermediate states
5052
wherein not all the related updates have been done.
5153
</para>
54+
55+
<para>
56+
If the isolation level or read/write mode is specified, the new
57+
transaction has those characteristics, as if
58+
<xref linkend="sql-set-transaction" endterm="sql-set-transaction-title">
59+
was executed.
60+
</para>
5261
</refsect1>
5362

5463
<refsect1>
@@ -65,6 +74,12 @@ BEGIN [ WORK | TRANSACTION ]
6574
</listitem>
6675
</varlistentry>
6776
</variablelist>
77+
78+
<para>
79+
See under <xref linkend="sql-set-transaction"
80+
endterm="sql-set-transaction-title"> about the meaning of the
81+
other parameters.
82+
</para>
6883
</refsect1>
6984

7085
<refsect1>

‎doc/src/sgml/ref/start_transaction.sgml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/start_transaction.sgml,v 1.9 2003/11/29 19:51:39 pgsql Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/start_transaction.sgml,v 1.10 2004/01/10 02:21:08 momjian Exp $
33
PostgreSQL documentation
44
-->
55

@@ -33,9 +33,8 @@ START TRANSACTION
3333
This command begins a new transaction. If the isolation level or
3434
read/write mode is specified, the new transaction has those
3535
characteristics, as if <xref linkend="sql-set-transaction"
36-
endterm="sql-set-transaction-title"> was executed. In all other
37-
respects, the behavior of this command is identical to the <xref
38-
linkend="sql-begin" endterm="sql-begin-title"> command.
36+
endterm="sql-set-transaction-title"> was executed. It is the same
37+
as the <xref linkend="sql-begin" endterm="sql-begin-title"> command.
3938
</para>
4039
</refsect1>
4140

‎src/backend/parser/gram.y

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.443 2004/01/07 18:56:27 neilc Exp $
14+
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.444 2004/01/10 02:21:08 momjian Exp $
1515
*
1616
* HISTORY
1717
* AUTHORDATEMAJOR EVENT
@@ -3674,11 +3674,11 @@ TransactionStmt:
36743674
n->options = NIL;
36753675
$$ = (Node *)n;
36763676
}
3677-
| BEGIN_P opt_transaction
3677+
| BEGIN_P opt_transaction transaction_mode_list_or_empty
36783678
{
36793679
TransactionStmt *n = makeNode(TransactionStmt);
36803680
n->kind = TRANS_STMT_BEGIN;
3681-
n->options =NIL;
3681+
n->options =$3;
36823682
$$ = (Node *)n;
36833683
}
36843684
| START TRANSACTION transaction_mode_list_or_empty

‎src/bin/psql/tab-complete.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.97 2003/12/01 22:21:54 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.98 2004/01/10 02:21:08 momjian Exp $
77
*/
88

99
/*----------------------------------------------------------------------
@@ -723,6 +723,18 @@ psql_completion(char *text, int start, int end)
723723
elseif (strcasecmp(prev2_wd,"ANALYZE")==0)
724724
COMPLETE_WITH_CONST(";");
725725

726+
/* BEGIN, COMMIT, ROLLBACK, ABORT, */
727+
elseif (strcasecmp(prev_wd,"BEGIN")==0||
728+
strcasecmp(prev_wd,"END")==0||
729+
strcasecmp(prev_wd,"COMMIT")==0||
730+
strcasecmp(prev_wd,"ROLLBACK")==0||
731+
strcasecmp(prev_wd,"ABORT")==0)
732+
{
733+
staticconstchar*constlist_TRANS[]=
734+
{"WORK","TRANSACTION",NULL};
735+
736+
COMPLETE_WITH_LIST(list_TRANS);
737+
}
726738
/* CLUSTER */
727739
/* If the previous word is CLUSTER, produce list of indexes. */
728740
elseif (strcasecmp(prev_wd,"CLUSTER")==0)
@@ -1099,10 +1111,14 @@ psql_completion(char *text, int start, int end)
10991111
strcasecmp(prev_wd,"SHOW")==0)
11001112
COMPLETE_WITH_LIST(pgsql_variables);
11011113
/* Complete "SET TRANSACTION" */
1102-
elseif ((strcasecmp(prev2_wd,"SET")==0
1103-
&&strcasecmp(prev_wd,"TRANSACTION")==0)
1114+
elseif ((strcasecmp(prev2_wd,"SET")==0&&
1115+
strcasecmp(prev_wd,"TRANSACTION")==0)
11041116
|| (strcasecmp(prev2_wd,"START")==0
11051117
&&strcasecmp(prev_wd,"TRANSACTION")==0)
1118+
|| (strcasecmp(prev2_wd,"BEGIN")==0
1119+
&&strcasecmp(prev_wd,"WORK")==0)
1120+
|| (strcasecmp(prev2_wd,"BEGIN")==0
1121+
&&strcasecmp(prev_wd,"TRANSACTION")==0)
11061122
|| (strcasecmp(prev4_wd,"SESSION")==0
11071123
&&strcasecmp(prev3_wd,"CHARACTERISTICS")==0
11081124
&&strcasecmp(prev2_wd,"AS")==0

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp