1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-23 14:01:44 +03:00

Allow optional SAVEPOINT keyword in RELEASE and ROLLBACK TO, for greater

compliance with SQL2003 spec syntax.

Oliver Jowett
This commit is contained in:
Tom Lane
2004-08-12 19:12:21 +00:00
parent 10249abfa1
commit a583675108
8 changed files with 118 additions and 94 deletions

View File

@ -1,5 +1,5 @@
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/allfiles.sgml,v 1.60 2004/08/01 17:32:13 tgl Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/allfiles.sgml,v 1.61 2004/08/12 19:12:21 tgl Exp $
PostgreSQL documentation
Complete list of usable sgml source files in this directory.
-->
@ -88,7 +88,7 @@ Complete list of usable sgml source files in this directory.
<!entity notify system "notify.sgml">
<!entity prepare system "prepare.sgml">
<!entity reindex system "reindex.sgml">
<!entity releaseSavepoint system "release.sgml">
<!entity releaseSavepoint system "release_savepoint.sgml">
<!entity reset system "reset.sgml">
<!entity revoke system "revoke.sgml">
<!entity rollback system "rollback.sgml">

View File

@ -1,31 +1,31 @@
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/release.sgml,v 1.1 2004/08/01 17:32:13 tgl Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/release_savepoint.sgml,v 1.1 2004/08/12 19:12:21 tgl Exp $
PostgreSQL documentation
-->
<refentry id="SQL-RELEASE">
<refentry id="SQL-RELEASE-SAVEPOINT">
<refmeta>
<refentrytitle id="SQL-RELEASE-TITLE">RELEASE</refentrytitle>
<refentrytitle id="SQL-RELEASE-SAVEPOINT-TITLE">RELEASE SAVEPOINT</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>RELEASE</refname>
<refname>RELEASE SAVEPOINT</refname>
<refpurpose>destroy a previously defined savepoint</refpurpose>
</refnamediv>
<indexterm zone="sql-release">
<primary>RELEASE</primary>
<indexterm zone="sql-release-savepoint">
<primary>RELEASE SAVEPOINT</primary>
</indexterm>
<indexterm zone="sql-release">
<indexterm zone="sql-release-savepoint">
<primary>savepoints</primary>
<secondary>releasing</secondary>
</indexterm>
<refsynopsisdiv>
<synopsis>
RELEASE <replaceable>savepoint_name</replaceable>
RELEASE [ SAVEPOINT ] <replaceable>savepoint_name</replaceable>
</synopsis>
</refsynopsisdiv>
@ -33,7 +33,7 @@ RELEASE <replaceable>savepoint_name</replaceable>
<title>Description</title>
<para>
<command>RELEASE</command> destroys a savepoint previously defined
<command>RELEASE SAVEPOINT</command> destroys a savepoint previously defined
in the current transaction.
</para>
@ -48,7 +48,7 @@ RELEASE <replaceable>savepoint_name</replaceable>
</para>
<para>
<command>RELEASE</command> also destroys all savepoints that were
<command>RELEASE SAVEPOINT</command> also destroys all savepoints that were
established after the named savepoint was established.
</para>
</refsect1>
@ -97,7 +97,7 @@ BEGIN;
INSERT INTO table VALUES (3);
SAVEPOINT my_savepoint;
INSERT INTO table VALUES (4);
RELEASE my_savepoint;
RELEASE SAVEPOINT my_savepoint;
COMMIT;
</programlisting>
The above transaction will insert both 3 and 4.
@ -108,7 +108,9 @@ COMMIT;
<title>Compatibility</title>
<para>
RELEASE is fully conforming to the SQL standard.
The SQL2003 standard specifies that the keyword SAVEPOINT is mandatory.
<productname>PostgreSQL</productname> allows the SAVEPOINT keyword to be
omitted. Otherwise, this command is fully conforming.
</para>
</refsect1>

View File

@ -1,21 +1,21 @@
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/rollback_to.sgml,v 1.1 2004/08/01 17:32:13 tgl Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/rollback_to.sgml,v 1.2 2004/08/12 19:12:21 tgl Exp $
PostgreSQL documentation
-->
<refentry id="SQL-ROLLBACK-TO">
<refmeta>
<refentrytitle id="SQL-ROLLBACK-TO-TITLE">ROLLBACK TO</refentrytitle>
<refentrytitle id="SQL-ROLLBACK-TO-TITLE">ROLLBACK TO SAVEPOINT</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>ROLLBACK TO</refname>
<refname>ROLLBACK TO SAVEPOINT</refname>
<refpurpose>roll back to a savepoint</refpurpose>
</refnamediv>
<indexterm zone="sql-rollback-to">
<primary>ROLLBACK TO</primary>
<primary>ROLLBACK TO SAVEPOINT</primary>
</indexterm>
<indexterm zone="sql-rollback-to">
@ -25,7 +25,7 @@ PostgreSQL documentation
<refsynopsisdiv>
<synopsis>
ROLLBACK TO <replaceable>savepoint_name</replaceable>
ROLLBACK [ WORK | TRANSACTION ] TO [ SAVEPOINT ] <replaceable>savepoint_name</replaceable>
</synopsis>
</refsynopsisdiv>
@ -39,7 +39,7 @@ ROLLBACK TO <replaceable>savepoint_name</replaceable>
</para>
<para>
<command>ROLLBACK TO</> implicitly destroys all savepoints that
<command>ROLLBACK TO SAVEPOINT</> implicitly destroys all savepoints that
were established after the named savepoint.
</para>
</refsect1>
@ -63,9 +63,9 @@ ROLLBACK TO <replaceable>savepoint_name</replaceable>
<title>Notes</title>
<para>
Use <xref linkend="SQL-RELEASE" endterm="SQL-RELEASE-TITLE"> to
destroy a savepoint without discarding the effects of commands executed
after it was established.
Use <xref linkend="SQL-RELEASE-SAVEPOINT"
endterm="SQL-RELEASE-SAVEPOINT-TITLE"> to destroy a savepoint without
discarding the effects of commands executed after it was established.
</para>
<para>
@ -81,7 +81,7 @@ ROLLBACK TO <replaceable>savepoint_name</replaceable>
left it pointing to (that is, <command>FETCH</> is not rolled back).
A cursor whose execution causes a transaction to abort is put in a
can't-execute state, so while the transaction can be restored using
<command>ROLLBACK TO</>, the cursor can no longer be used.
<command>ROLLBACK TO SAVEPOINT</>, the cursor can no longer be used.
</para>
</refsect1>
@ -92,7 +92,7 @@ ROLLBACK TO <replaceable>savepoint_name</replaceable>
To undo the effects of the commands executed after <literal>my_savepoint</literal>
was established:
<programlisting>
ROLLBACK TO my_savepoint;
ROLLBACK TO SAVEPOINT my_savepoint;
</programlisting>
</para>
@ -110,7 +110,7 @@ FETCH 1 FROM foo;
----------
1
ROLLBACK TO foo;
ROLLBACK TO SAVEPOINT foo;
FETCH 1 FROM foo;
?column?
@ -128,7 +128,13 @@ COMMIT;
<title>Compatibility</title>
<para>
This command is fully SQL standard conforming.
The SQL2003 standard specifies that the keyword SAVEPOINT is mandatory.
<productname>PostgreSQL</productname> and <productname>Oracle</productname>
allow the SAVEPOINT keyword to be omitted. SQL2003 allows only
WORK, not TRANSACTION, as a noise word after ROLLBACK. Also, SQL2003
has an optional clause AND [ NO ] CHAIN which is not currently supported
by <productname>PostgreSQL</productname>. Otherwise, this command is
fully conforming.
</para>
</refsect1>
@ -139,7 +145,7 @@ COMMIT;
<member><xref linkend="sql-begin" endterm="sql-begin-title"></member>
<member><xref linkend="sql-commit" endterm="sql-commit-title"></member>
<member><xref linkend="sql-savepoint" endterm="sql-savepoint-title"></member>
<member><xref linkend="sql-release" endterm="sql-release-title"></member>
<member><xref linkend="sql-release-savepoint" endterm="sql-release-savepoint-title"></member>
<member><xref linkend="sql-rollback" endterm="sql-rollback-title"></member>
</simplelist>
</refsect1>

View File

@ -1,5 +1,5 @@
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/savepoint.sgml,v 1.1 2004/08/01 17:32:13 tgl Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/savepoint.sgml,v 1.2 2004/08/12 19:12:21 tgl Exp $
PostgreSQL documentation
-->
@ -64,8 +64,8 @@ SAVEPOINT <replaceable>savepoint_name</replaceable>
<para>
Use <xref linkend="SQL-ROLLBACK-TO" endterm="SQL-ROLLBACK-TO-TITLE"> to
rollback to a savepoint. Use <xref linkend="SQL-RELEASE"
endterm="SQL-RELEASE-TITLE"> to destroy a savepoint, keeping
rollback to a savepoint. Use <xref linkend="SQL-RELEASE-SAVEPOINT"
endterm="SQL-RELEASE-SAVEPOINT-TITLE"> to destroy a savepoint, keeping
the effects of commands executed after it was established.
</para>
@ -86,7 +86,7 @@ BEGIN;
INSERT INTO table VALUES (1);
SAVEPOINT my_savepoint;
INSERT INTO table VALUES (2);
ROLLBACK TO my_savepoint;
ROLLBACK TO SAVEPOINT my_savepoint;
INSERT INTO table VALUES (3);
COMMIT;
</programlisting>
@ -100,7 +100,7 @@ BEGIN;
INSERT INTO table VALUES (3);
SAVEPOINT my_savepoint;
INSERT INTO table VALUES (4);
RELEASE my_savepoint;
RELEASE SAVEPOINT my_savepoint;
COMMIT;
</programlisting>
The above transaction will insert both 3 and 4.
@ -116,8 +116,8 @@ COMMIT;
<productname>PostgreSQL</>, the old savepoint is kept, though only the more
recent one will be used when rolling back or releasing. (Releasing the
newer savepoint will cause the older one to again become accessible to
<command>ROLLBACK TO</> and <command>RELEASE</>.)
Other than that, <command>SAVEPOINT</command> is fully SQL conforming.
<command>ROLLBACK TO SAVEPOINT</> and <command>RELEASE SAVEPOINT</>.)
Otherwise, <command>SAVEPOINT</command> is fully SQL conforming.
</para>
</refsect1>
@ -128,7 +128,7 @@ COMMIT;
<member><xref linkend="sql-begin" endterm="sql-begin-title"></member>
<member><xref linkend="sql-rollback" endterm="sql-rollback-title"></member>
<member><xref linkend="sql-rollback-to" endterm="sql-rollback-to-title"></member>
<member><xref linkend="sql-release" endterm="sql-release-title"></member>
<member><xref linkend="sql-release-savepoint" endterm="sql-release-savepoint-title"></member>
<member><xref linkend="sql-commit" endterm="sql-commit-title"></member>
</simplelist>
</refsect1>