BEGIN WORK and transaction isolation level - Mailing list pgsql-patches
From | Bruce Momjian |
---|---|
Subject | BEGIN WORK and transaction isolation level |
Date | |
Msg-id | 200401100222.i0A2M6O03432@candle.pha.pa.us Whole thread Raw |
List | pgsql-patches |
This applied patch adds transaction isolation level to BEGIN WORK just like START TRANSACTION. The bottom of the patch improves table completion for transaction commands. This was discussed and approved a while ago. (Peter objected, though.) -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 Index: doc/src/sgml/ref/begin.sgml =================================================================== RCS file: /cvsroot/pgsql-server/doc/src/sgml/ref/begin.sgml,v retrieving revision 1.26 diff -c -c -r1.26 begin.sgml *** doc/src/sgml/ref/begin.sgml 9 Sep 2003 18:28:52 -0000 1.26 --- doc/src/sgml/ref/begin.sgml 10 Nov 2003 03:08:31 -0000 *************** *** 21,26 **** --- 21,28 ---- <refsynopsisdiv> <synopsis> BEGIN [ WORK | TRANSACTION ] + [ ISOLATION LEVEL { READ UNCOMMITTED | READ COMMITTED | REPEATABLE READ | SERIALIZABLE } ] + [ READ WRITE | READ ONLY ] </synopsis> </refsynopsisdiv> *************** *** 49,54 **** --- 51,63 ---- other sessions will be unable to see the intermediate states wherein not all the related updates have been done. </para> + + <para> + If the isolation level or read/write mode is specified, the new + transaction has those characteristics, as if + <xref linkend="sql-set-transaction" endterm="sql-set-transaction-title"> + was executed. + </para> </refsect1> <refsect1> *************** *** 65,70 **** --- 74,85 ---- </listitem> </varlistentry> </variablelist> + + <para> + See under <xref linkend="sql-set-transaction" + endterm="sql-set-transaction-title"> about the meaning of the + other parameters. + </para> </refsect1> <refsect1> Index: doc/src/sgml/ref/start_transaction.sgml =================================================================== RCS file: /cvsroot/pgsql-server/doc/src/sgml/ref/start_transaction.sgml,v retrieving revision 1.8 diff -c -c -r1.8 start_transaction.sgml *** doc/src/sgml/ref/start_transaction.sgml 6 Nov 2003 22:08:14 -0000 1.8 --- doc/src/sgml/ref/start_transaction.sgml 10 Nov 2003 03:08:31 -0000 *************** *** 33,41 **** This command begins a new transaction. If the isolation level or read/write mode is specified, the new transaction has those characteristics, as if <xref linkend="sql-set-transaction" ! endterm="sql-set-transaction-title"> was executed. In all other ! respects, the behavior of this command is identical to the <xref ! linkend="sql-begin" endterm="sql-begin-title"> command. </para> </refsect1> --- 33,40 ---- This command begins a new transaction. If the isolation level or read/write mode is specified, the new transaction has those characteristics, as if <xref linkend="sql-set-transaction" ! endterm="sql-set-transaction-title"> was executed. It is the same ! as the <xref linkend="sql-begin" endterm="sql-begin-title"> command. </para> </refsect1> Index: src/backend/parser/gram.y =================================================================== RCS file: /cvsroot/pgsql-server/src/backend/parser/gram.y,v retrieving revision 2.437 diff -c -c -r2.437 gram.y *** src/backend/parser/gram.y 6 Nov 2003 22:08:14 -0000 2.437 --- src/backend/parser/gram.y 10 Nov 2003 03:08:38 -0000 *************** *** 3607,3617 **** n->options = NIL; $$ = (Node *)n; } ! | BEGIN_P opt_transaction { TransactionStmt *n = makeNode(TransactionStmt); n->kind = TRANS_STMT_BEGIN; ! n->options = NIL; $$ = (Node *)n; } | START TRANSACTION transaction_mode_list_or_empty --- 3607,3617 ---- n->options = NIL; $$ = (Node *)n; } ! | BEGIN_P opt_transaction transaction_mode_list_or_empty { TransactionStmt *n = makeNode(TransactionStmt); n->kind = TRANS_STMT_BEGIN; ! n->options = $3; $$ = (Node *)n; } | START TRANSACTION transaction_mode_list_or_empty Index: src/bin/psql/tab-complete.c =================================================================== RCS file: /cvsroot/pgsql-server/src/bin/psql/tab-complete.c,v retrieving revision 1.93 diff -c -c -r1.93 tab-complete.c *** src/bin/psql/tab-complete.c 8 Nov 2003 20:54:24 -0000 1.93 --- src/bin/psql/tab-complete.c 10 Nov 2003 03:08:45 -0000 *************** *** 725,730 **** --- 725,742 ---- 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) *************** *** 1101,1109 **** 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) || (strcasecmp(prev2_wd, "START") == 0 && strcasecmp(prev_wd, "TRANSACTION") == 0) || (strcasecmp(prev4_wd, "SESSION") == 0 && strcasecmp(prev3_wd, "CHARACTERISTICS") == 0 --- 1113,1125 ---- 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) || (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
pgsql-patches by date: