You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by re...@apache.org on 2026/02/26 12:59:20 UTC
(cloudberry) 06/24: doc: clarify the behavior of identically-named savepoints
This is an automated email from the ASF dual-hosted git repository.
reshke pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit 60817b573cd38b04dab1003be17876a57b9f3f35
Author: Bruce Momjian <br...@momjian.us>
AuthorDate: Thu Jul 14 15:44:22 2022 -0400
doc: clarify the behavior of identically-named savepoints
Original patch by David G. Johnston.
Reported-by: David G. Johnston
Discussion: https://postgr.es/m/CAKFQuwYQCxSSuSL18skCWG8QHFswOJ3hjovHsOZUE346i4OpVQ@mail.gmail.com
Backpatch-through: 10
---
doc/src/sgml/ref/release_savepoint.sgml | 5 +++--
doc/src/sgml/ref/savepoint.sgml | 30 +++++++++++++++++++++++++++++-
2 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/doc/src/sgml/ref/release_savepoint.sgml b/doc/src/sgml/ref/release_savepoint.sgml
index 39665d28efa..daf8eb9a436 100644
--- a/doc/src/sgml/ref/release_savepoint.sgml
+++ b/doc/src/sgml/ref/release_savepoint.sgml
@@ -82,8 +82,9 @@ RELEASE [ SAVEPOINT ] <replaceable>savepoint_name</replaceable>
</para>
<para>
- If multiple savepoints have the same name, only the one that was most
- recently defined is released.
+ If multiple savepoints have the same name, only the most recently defined
+ unreleased one is released. Repeated commands will release progressively
+ older savepoints.
</para>
</refsect1>
diff --git a/doc/src/sgml/ref/savepoint.sgml b/doc/src/sgml/ref/savepoint.sgml
index b17342a1ee6..f84ac3d167f 100644
--- a/doc/src/sgml/ref/savepoint.sgml
+++ b/doc/src/sgml/ref/savepoint.sgml
@@ -53,7 +53,9 @@ SAVEPOINT <replaceable>savepoint_name</replaceable>
<term><replaceable>savepoint_name</replaceable></term>
<listitem>
<para>
- The name to give to the new savepoint.
+ The name to give to the new savepoint. If savepoints with the
+ same name already exist, they will be inaccessible until newer
+ identically-named savepoints are released.
</para>
</listitem>
</varlistentry>
@@ -106,6 +108,32 @@ COMMIT;
</programlisting>
The above transaction will insert both 3 and 4.
</para>
+
+ <para>
+ To use a single savepoint name:
+<programlisting>
+BEGIN;
+ INSERT INTO table1 VALUES (1);
+ SAVEPOINT my_savepoint;
+ INSERT INTO table1 VALUES (2);
+ SAVEPOINT my_savepoint;
+ INSERT INTO table1 VALUES (3);
+
+ -- rollback to the second savepoint
+ ROLLBACK TO SAVEPOINT my_savepoint;
+ SELECT * FROM table1; -- shows rows 1 and 2
+
+ -- release the second savepoint
+ RELEASE SAVEPOINT my_savepoint;
+
+ -- rollback to the first savepoint
+ ROLLBACK TO SAVEPOINT my_savepoint;
+ SELECT * FROM table1; -- shows only row 1
+COMMIT;
+</programlisting>
+ The above transaction shows row 3 being rolled back first, then row 2.
+ </para>
+
</refsect1>
<refsect1>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org