diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2019-03-24 10:33:14 +0100 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2019-03-24 11:33:02 +0100 |
commit | 280a408b48d5ee42969f981bceb9e9426c3a344c (patch) | |
tree | 07cb0ab7cfdbb369e76130ef2cff56f65d0285a2 /doc/src/sgml/ref/commit.sgml | |
parent | b2db277057a375ccbcc98cc3bbce8ce5b4d788ea (diff) | |
download | postgresql-280a408b48d5ee42969f981bceb9e9426c3a344c.tar.gz postgresql-280a408b48d5ee42969f981bceb9e9426c3a344c.zip |
Transaction chaining
Add command variants COMMIT AND CHAIN and ROLLBACK AND CHAIN, which
start new transactions with the same transaction characteristics as the
just finished one, per SQL standard.
Support for transaction chaining in PL/pgSQL is also added. This
functionality is especially useful when running COMMIT in a loop in
PL/pgSQL.
Reviewed-by: Fabien COELHO <coelho@cri.ensmp.fr>
Discussion: https://www.postgresql.org/message-id/flat/28536681-324b-10dc-ade8-ab46f7645a5a@2ndquadrant.com
Diffstat (limited to 'doc/src/sgml/ref/commit.sgml')
-rw-r--r-- | doc/src/sgml/ref/commit.sgml | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/doc/src/sgml/ref/commit.sgml b/doc/src/sgml/ref/commit.sgml index b2e8d5d1807..e4169cd2c62 100644 --- a/doc/src/sgml/ref/commit.sgml +++ b/doc/src/sgml/ref/commit.sgml @@ -21,7 +21,7 @@ PostgreSQL documentation <refsynopsisdiv> <synopsis> -COMMIT [ WORK | TRANSACTION ] +COMMIT [ WORK | TRANSACTION ] [ AND [ NO ] CHAIN ] </synopsis> </refsynopsisdiv> @@ -38,6 +38,10 @@ COMMIT [ WORK | TRANSACTION ] <refsect1> <title>Parameters</title> + <indexterm zone="sql-commit-chain"> + <primary>chained transactions</primary> + </indexterm> + <variablelist> <varlistentry> <term><literal>WORK</literal></term> @@ -48,6 +52,18 @@ COMMIT [ WORK | TRANSACTION ] </para> </listitem> </varlistentry> + + <varlistentry id="sql-commit-chain"> + <term><literal>AND CHAIN</literal></term> + <listitem> + <para> + If <literal>AND CHAIN</literal> is specified, a new transaction is + immediately started with the same transaction characteristics (see <xref + linkend="sql-set-transaction"/>) as the just finished one. Otherwise, + no new transaction is started. + </para> + </listitem> + </varlistentry> </variablelist> </refsect1> @@ -79,9 +95,8 @@ COMMIT; <title>Compatibility</title> <para> - The SQL standard only specifies the two forms - <literal>COMMIT</literal> and <literal>COMMIT - WORK</literal>. Otherwise, this command is fully conforming. + The command <command>COMMIT</command> conforms to the SQL standard. The + form <literal>COMMIT TRANSACTION</literal> is a PostgreSQL extension. </para> </refsect1> |