-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Attached is a diff for subtransactions. I modified the SQL reference
section and touched on the various commands therein. I didn't mention
anything about cursors or portals, because I bet they will be resolved
before long.
I looked at the tutorial pages and the MVCC pages and I decided that
subtransactions don't really belong in either place. People who want them
will know they need them when they encounter a situation that demands
them. I see them being used mostly in PL/pgSQL type situations.
Maybe some documentation on the internals is warranted - but I don't know
nearly enough on that to do that task.
- --
Jonathan Gardner
[EMAIL PROTECTED]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
iD8DBQFA+Xngqp6r/MVGlwwRAot7AJ9DBZSk1l0vkSDsaQzYUWe16jKh4wCeJ+AM
njA7/4j/mawBwOLKw8GykxY=
=415C
-----END PGP SIGNATURE-----
Index: doc/src/sgml/ref/abort.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql-server/doc/src/sgml/ref/abort.sgml,v
retrieving revision 1.16
diff -c -r1.16 abort.sgml
*** doc/src/sgml/ref/abort.sgml 29 Nov 2003 19:51:38 -0000 1.16
--- doc/src/sgml/ref/abort.sgml 17 Jul 2004 19:05:51 -0000
***************
*** 35,40 ****
--- 35,45 ----
<xref linkend="SQL-ROLLBACK" endterm="SQL-ROLLBACK-TITLE">,
and is present only for historical reasons.
</para>
+
+ <para>
+ Note that in a subtransaction, <command>ABORT</command> will only roll back
+ the subtransaction, and does not roll back the parent transaction.
+ </para>
</refsect1>
<refsect1>
Index: doc/src/sgml/ref/begin.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql-server/doc/src/sgml/ref/begin.sgml,v
retrieving revision 1.30
diff -c -r1.30 begin.sgml
*** doc/src/sgml/ref/begin.sgml 11 Jan 2004 09:24:17 -0000 1.30
--- doc/src/sgml/ref/begin.sgml 17 Jul 2004 19:05:51 -0000
***************
*** 53,63 ****
</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>
--- 53,74 ----
</para>
<para>
+ <command>BEGIN</command> commands issued in a transaction will initiate a
+ subtransaction block, or a transaction within a transaction. When the
+ subtransaction is completed (via a <xref
+ linkend="sql-commit" endterm="sql-commit-title"> or <xref
+ linkend="sql-rollback" endterm="sql-rollback-title">), control is
+ returned to the parent transaction.
+ </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. These cannot be specified for subtransactions.
! Subtransactions inherit these attributes from their parent transactions.
</para>
+
</refsect1>
<refsect1>
***************
*** 88,94 ****
<para>
<xref linkend="sql-start-transaction"
endterm="sql-start-transaction-title"> has the same functionality
! as <command>BEGIN</>.
</para>
<para>
--- 99,106 ----
<para>
<xref linkend="sql-start-transaction"
endterm="sql-start-transaction-title"> has the same functionality
! as <command>BEGIN</command>. Note that these parameters are illegal for
! subtransactions.
</para>
<para>
***************
*** 97,106 ****
to terminate a transaction block.
</para>
- <para>
- Issuing <command>BEGIN</> when already inside a transaction block will
- provoke a warning message. The state of the transaction is not affected.
- </para>
</refsect1>
<refsect1>
--- 109,114 ----
Index: doc/src/sgml/ref/commit.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql-server/doc/src/sgml/ref/commit.sgml,v
retrieving revision 1.19
diff -c -r1.19 commit.sgml
*** doc/src/sgml/ref/commit.sgml 29 Nov 2003 19:51:38 -0000 1.19
--- doc/src/sgml/ref/commit.sgml 17 Jul 2004 19:05:51 -0000
***************
*** 32,37 ****
--- 32,42 ----
changes made by the transaction become visible to others
and are guaranteed to be durable if a crash occurs.
</para>
+
+ <para>
+ Note that in a subtransaction, <command>COMMIT</command> will only commit the
+ subtransaction, and does not commit the parent transaction.
+ </para>
</refsect1>
<refsect1>
Index: doc/src/sgml/ref/end.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql-server/doc/src/sgml/ref/end.sgml,v
retrieving revision 1.13
diff -c -r1.13 end.sgml
*** doc/src/sgml/ref/end.sgml 29 Nov 2003 19:51:38 -0000 1.13
--- doc/src/sgml/ref/end.sgml 17 Jul 2004 19:05:51 -0000
***************
*** 35,40 ****
--- 35,45 ----
that is equivalent to <xref linkend="sql-commit"
endterm="sql-commit-title">.
</para>
+
+ <para>
+ Note that in a subtransaction, <command>END</command> will only commit the
+ subtransaction, and does not commit the parent transaction.
+ </para>
</refsect1>
<refsect1>
Index: doc/src/sgml/ref/rollback.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql-server/doc/src/sgml/ref/rollback.sgml,v
retrieving revision 1.17
diff -c -r1.17 rollback.sgml
*** doc/src/sgml/ref/rollback.sgml 29 Nov 2003 19:51:39 -0000 1.17
--- doc/src/sgml/ref/rollback.sgml 17 Jul 2004 19:05:51 -0000
***************
*** 31,36 ****
--- 31,41 ----
<command>ROLLBACK</command> rolls back the current transaction and causes
all the updates made by the transaction to be discarded.
</para>
+
+ <para>
+ Note that in a subtransaction, <command>ROLLBACK</command> will only roll
+ back the subtransaction, and does not roll back the parent transaction.
+ </para>
</refsect1>
<refsect1>
Index: doc/src/sgml/ref/set_transaction.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql-server/doc/src/sgml/ref/set_transaction.sgml,v
retrieving revision 1.19
diff -c -r1.19 set_transaction.sgml
*** doc/src/sgml/ref/set_transaction.sgml 29 Nov 2003 19:51:39 -0000 1.19
--- doc/src/sgml/ref/set_transaction.sgml 17 Jul 2004 19:05:51 -0000
***************
*** 120,125 ****
--- 120,131 ----
and in the configuration file. Consult <xref linkend="runtime-config"> for more
information.
</para>
+
+ <para>
+ <command>SET TRANSACTION</command> is currently illegal within a
+ subtransaction.
+ </para>
+
</refsect1>
<refsect1 id="R1-SQL-SET-TRANSACTION-3">
Index: doc/src/sgml/ref/start_transaction.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql-server/doc/src/sgml/ref/start_transaction.sgml,v
retrieving revision 1.11
diff -c -r1.11 start_transaction.sgml
*** doc/src/sgml/ref/start_transaction.sgml 11 Jan 2004 05:46:58 -0000 1.11
--- doc/src/sgml/ref/start_transaction.sgml 17 Jul 2004 19:05:51 -0000
***************
*** 30,40 ****
<title>Description</title>
<para>
! 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>
--- 30,41 ----
<title>Description</title>
<para>
! This command begins a new transaction or subtransaction. 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. These cannot be
! specified for subtransactions, however. It is the same as the
! <xref linkend="sql-begin" endterm="sql-begin-title"> command.
</para>
</refsect1>
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?
http://archives.postgresql.org