From: Florian Pflug on 25 May 2010 06:03 On May 25, 2010, at 6:08 , Sam Vilain wrote: > http://www.postgresql.org/docs/8.4/static/sql-savepoint.html > > Lead us to believe that if you roll back to the same savepoint name > twice in a row, that you might start walking back through the > savepoints. I guess I missed the note on ROLLBACK TO SAVEPOINT that > that is not how it works. > > Here is the section: > > SQL requires a savepoint to be destroyed automatically when another > savepoint with the same name is established. In 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 ROLLBACK TO SAVEPOINT and > RELEASE SAVEPOINT.) Otherwise, SAVEPOINT is fully SQL conforming. I'm confused. The sentence in brackets "Releasing the newer savepoint will cause the older one to again become accessible to ROLLBACK TO SAVEPOINT and RELEASE SAVEPOINT" implies that you *will* walk backwards through all the savepoints named "a" if you repeatedly issue "ROLLBACK TO SAVEPOINT a", no? If that is not how it actually works, then this whole paragraph is wrong, I'd say. best regards, Florian Pflug -- Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
From: Heikki Linnakangas on 25 May 2010 06:18 On 25/05/10 13:03, Florian Pflug wrote: > On May 25, 2010, at 6:08 , Sam Vilain wrote: >> http://www.postgresql.org/docs/8.4/static/sql-savepoint.html >> >> Lead us to believe that if you roll back to the same savepoint name >> twice in a row, that you might start walking back through the >> savepoints. I guess I missed the note on ROLLBACK TO SAVEPOINT that >> that is not how it works. >> >> Here is the section: >> >> SQL requires a savepoint to be destroyed automatically when another >> savepoint with the same name is established. In 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 ROLLBACK TO SAVEPOINT and >> RELEASE SAVEPOINT.) Otherwise, SAVEPOINT is fully SQL conforming. > > I'm confused. The sentence in brackets "Releasing the newer savepoint will cause the older one to again become accessible to ROLLBACK TO SAVEPOINT and RELEASE SAVEPOINT" implies that you *will* walk backwards through all the savepoints named "a" if you repeatedly issue "ROLLBACK TO SAVEPOINT a", no? If that is not how it actually works, then this whole paragraph is wrong, I'd say. Releasing the newer savepoint will cause the older one to again become accessible, as the doc says, but rolling back to a savepoint does not implicitly release it. You'll have to use RELEASE SAVEPOINT for that. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com -- Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
From: Florian Pflug on 25 May 2010 06:46 On May 25, 2010, at 12:18 , Heikki Linnakangas wrote: > On 25/05/10 13:03, Florian Pflug wrote: >> On May 25, 2010, at 6:08 , Sam Vilain wrote: >>> http://www.postgresql.org/docs/8.4/static/sql-savepoint.html >>> >>> Lead us to believe that if you roll back to the same savepoint name >>> twice in a row, that you might start walking back through the >>> savepoints. I guess I missed the note on ROLLBACK TO SAVEPOINT that >>> that is not how it works. >>> >>> Here is the section: >>> >>> SQL requires a savepoint to be destroyed automatically when another >>> savepoint with the same name is established. In 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 ROLLBACK TO SAVEPOINT and >>> RELEASE SAVEPOINT.) Otherwise, SAVEPOINT is fully SQL conforming. >> >> I'm confused. The sentence in brackets "Releasing the newer savepoint will cause the older one to again become accessible to ROLLBACK TO SAVEPOINT and RELEASE SAVEPOINT" implies that you *will* walk backwards through all the savepoints named "a" if you repeatedly issue "ROLLBACK TO SAVEPOINT a", no? If that is not how it actually works, then this whole paragraph is wrong, I'd say. > > Releasing the newer savepoint will cause the older one to again become accessible, as the doc says, but rolling back to a savepoint does not implicitly release it. You'll have to use RELEASE SAVEPOINT for that. Ah, now I get it. Thanks. Would changing "Releasing the newer savepoint will cause ... " to "Explicitly releasing the newer savepoint" or maybe even "Explicitly releasing the newer savepoint with RELEASE SAVEPOINT will cause ..." make things clearer? best regards, Florian Pflug -- Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
From: Sam Vilain on 25 May 2010 19:00 Florian Pflug wrote: > On May 25, 2010, at 12:18 , Heikki Linnakangas wrote: > >> On 25/05/10 13:03, Florian Pflug wrote: >> >>> On May 25, 2010, at 6:08 , Sam Vilain wrote: >>> >>>> http://www.postgresql.org/docs/8.4/static/sql-savepoint.html >>>> >>>> Lead us to believe that if you roll back to the same savepoint name >>>> twice in a row, that you might start walking back through the >>>> savepoints. I guess I missed the note on ROLLBACK TO SAVEPOINT that >>>> that is not how it works. >>>> >>>> Here is the section: >>>> >>>> SQL requires a savepoint to be destroyed automatically when another >>>> savepoint with the same name is established. In 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 ROLLBACK TO SAVEPOINT and >>>> RELEASE SAVEPOINT.) Otherwise, SAVEPOINT is fully SQL conforming. >>>> >>> I'm confused. The sentence in brackets "Releasing the newer savepoint will cause the older one to again become accessible to ROLLBACK TO SAVEPOINT and RELEASE SAVEPOINT" implies that you *will* walk backwards through all the savepoints named "a" if you repeatedly issue "ROLLBACK TO SAVEPOINT a", no? If that is not how it actually works, then this whole paragraph is wrong, I'd say. >>> >> Releasing the newer savepoint will cause the older one to again become accessible, as the doc says, but rolling back to a savepoint does not implicitly release it. You'll have to use RELEASE SAVEPOINT for that. >> > > Ah, now I get it. Thanks. > > Would changing "Releasing the newer savepoint will cause ... " to "Explicitly releasing the newer savepoint" or maybe even "Explicitly releasing the newer savepoint with RELEASE SAVEPOINT will cause ..." make things clearer? > Yes, probably - your misreading matches my misreading of it :-) There is another way you can get there - releasing to a savepoint before the re-used savepoint name will also release the savepoints after it. ie savepoint foo; savepoint bar; savepoint foo; release to savepoint bar; release to savepoint foo; After the first release, the second 'foo' savepoint is gone. I think this is a key advantage in saving the old savepoints. Cheers, Sam -- Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
From: Heikki Linnakangas on 26 May 2010 18:58 On 26/05/10 02:00, Sam Vilain wrote: > Florian Pflug wrote: >> On May 25, 2010, at 12:18 , Heikki Linnakangas wrote: >>> Releasing the newer savepoint will cause the older one to again become accessible, as the doc says, but rolling back to a savepoint does not implicitly release it. You'll have to use RELEASE SAVEPOINT for that. >> >> Ah, now I get it. Thanks. >> >> Would changing "Releasing the newer savepoint will cause ... " to "Explicitly releasing the newer savepoint" or maybe even "Explicitly releasing the newer savepoint with RELEASE SAVEPOINT will cause ..." make things clearer? > > Yes, probably - your misreading matches my misreading of it :-) +1. > There is another way you can get there - releasing to a savepoint before > the re-used savepoint name will also release the savepoints after it. > > ie > > savepoint foo; > savepoint bar; > savepoint foo; > release to savepoint bar; > release to savepoint foo; > > After the first release, the second 'foo' savepoint is gone. I think > this is a key advantage in saving the old savepoints. Yep. Do we need to mention that in that notice? I don't think so, it would become really verbose. Florian's wording above seems fine. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com -- Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
|
Next
|
Last
Pages: 1 2 Prev: [HACKERS] ROLLBACK TO SAVEPOINT Next: [HACKERS] Hot Standby performance and deadlocking |