Thread: Two questions about savepoints: Bug or feature?

Two questions about savepoints: Bug or feature?

From
Devrim GUNDUZ
Date:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Hi,

I updated the CVS a few minutes before, applied Gavin Sherry's latest 
xact patch. It worked. 

Anyway...here is what I did:
==================Case 1=================================
test=# BEGIN ;
BEGIN
test=# SAVEPOINT devrim;
SAVEPOINT
test=# SAVEPOINT devrim;
SAVEPOINT
test=# SAVEPOINT devrim;
SAVEPOINT
test=# ROLLBACK to devrim;
ROLLBACK
test=# ROLLBACK to devrim;
ROLLBACK
test=# ROLLBACK to devrim;
ROLLBACK
test=# ROLLBACK to devrim;
ROLLBACK
test=# ROLLBACK to devrim;
ROLLBACK
test=# ROLLBACK to devrim;
ROLLBACK
test=# ROLLBACK to devrim;
ROLLBACK

...and it goes on forever. Is it a feature or a bug?

Now case 2:
==================Case 2=================================
test=# BEGIN ;
BEGIN
test=# INSERT INTO a VALUES ('123');
INSERT 17231 1
test=# INSERT INTO a VALUES ('1dfsd');
INSERT 17232 1
test=# SAVEPOINT devrim;
SAVEPOINT
test=# DELETE from a WHERE x ='123';
DELETE 1
test=# SAVEPOINT devrim;
SAVEPOINT
test=# DELETE from a WHERE x ='123';
DELETE 0
test=# SAVEPOINT devrim;
SAVEPOINT
test=# DELETE from a WHERE x ='1dfsd';
DELETE 1
test=# SELECT * from a ;x
- ---
(0 rows)                                                                               
test=# ROLLBACK to devrim;
ROLLBACK
test=# SELECT * from a ;  x
- -------1dfsd
(1 row)
test=# ROLLBACK to devrim;
ROLLBACK
test=# SELECT * from a ;  x
- -------1dfsd
(1 row)

test=# COMMIT ;
COMMIT

test=# SELECT * from a ;  x
- -------1dfsd

========================================

Are these all intended behaviors? I thought we wouldn't be able to give 
more than 1 same name to savepoints in a transaction, am I right?

Regards,

- -- 
Devrim GUNDUZ           
devrim~gunduz.org                devrim.gunduz~linux.org.tr         http://www.tdmsoft.com
http://www.gunduz.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFBD5fitl86P3SPfQ4RAuErAKDYC33X4CjYmv6TuoddJaBkl7TKYgCeN6ZF
/0Ky5+BWo1wFFNBdMpQ6txw=
=XV4n
-----END PGP SIGNATURE-----



Re: Two questions about savepoints: Bug or feature?

From
"Merlin Moncure"
Date:
> test=# ROLLBACK to devrim;
> ROLLBACK
> test=# ROLLBACK to devrim;
> ROLLBACK
>
> ...and it goes on forever. Is it a feature or a bug?
>

feature.  You can rollback to a savepoint multiple times (0 or more
savepoints might intervene)


> Are these all intended behaviors? I thought we wouldn't be able to
give
> more than 1 same name to savepoints in a transaction, am I right?

Nope.  Read:
http://www.destructor.de/firebird/1.5/savepoints.txt

Merlin


Re: Two questions about savepoints: Bug or feature?

From
Devrim GUNDUZ
Date:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Hi,

On Tue, 3 Aug 2004, Merlin Moncure wrote:

> > test=# ROLLBACK to devrim;
> > ROLLBACK
> > 
> > ...and it goes on forever. Is it a feature or a bug?
> 
> feature.  You can rollback to a savepoint multiple times (0 or more
> savepoints might intervene)

When I wrote that e-mail, I could not think of a situation that someone 
wanted to rollback to the same savepoint many times... But a few minutes 
ago I got the point. Sorry.

> > Are these all intended behaviors? I thought we wouldn't be able to
> give
> > more than 1 same name to savepoints in a transaction, am I right?
> 
> Nope.  Read:
> http://www.destructor.de/firebird/1.5/savepoints.txt

Thanks for the link. Now things are more clear to me.

Regards,
- -- 
Devrim GUNDUZ           
devrim~gunduz.org                devrim.gunduz~linux.org.tr         http://www.tdmsoft.com
http://www.gunduz.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFBD522tl86P3SPfQ4RAu6OAKCfs8Vy+p1FtS/xmOBXMKxhfmZWwACgqMRk
QJTgQaGYO3Z45Js6IIn3XvA=
=Y6Na
-----END PGP SIGNATURE-----



Re: Two questions about savepoints: Bug or feature?

From
Tom Lane
Date:
Devrim GUNDUZ <devrim@gunduz.org> writes:
> Are these all intended behaviors?

Yes.  Rolling back to a savepoint doesn't release the savepoint.  See
http://developer.postgresql.org/docs/postgres/sql-savepoint.html
http://developer.postgresql.org/docs/postgres/sql-rollback-to.html
http://developer.postgresql.org/docs/postgres/sql-release.html
        regards, tom lane