error in documentation?

Started by Michael Cochezover 18 years ago3 messagesdocs
Jump to latest
#1Michael Cochez
michaelcochez@yahoo.com

In http://www.postgresql.org/docs/8.2/static/tutorial-transactions.html
"After rolling back to a savepoint, it continues to be defined, so you can roll back to it several times. Conversely, if you are sure you won't need to roll back to a particular savepoint again, it can be released, so the system can free some resources. Keep in mind that either releasing or rolling back to a savepoint will automatically release all savepoints that were defined after it."
mustn't it be :
"After rolling back to a savepoint, it continues to be defined, so you can roll back to it several times. Conversely, if you are sure you won't need to roll back to a particular savepoint again, it can be released, so the system can free some resources. Keep in mind that rolling back to a savepoint will automatically release all savepoints that were defined after it and releasing a savepoint will automatically release all savepoints defined before it."

if not, could you please explain why this decision is made?
thanks,
Michael

---------------------------------
Don't let your dream ride pass you by. Make it a reality with Yahoo! Autos.

#2Phil Frost
phil@macprofessionals.com
In reply to: Michael Cochez (#1)
Re: error in documentation?

On Sep 24, 2007, at 10:03 , Michael Cochez wrote:

In http://www.postgresql.org/docs/8.2/static/tutorial-
transactions.html
"After rolling back to a savepoint, it continues to be defined, so
you can roll back to it several times. Conversely, if you are sure
you won't need to roll back to a particular savepoint again, it can
be released, so the system can free some resources. Keep in mind
that either releasing or rolling back to a savepoint will
automatically release all savepoints that were defined after it."
mustn't it be :
"After rolling back to a savepoint, it continues to be defined, so
you can roll back to it several times. Conversely, if you are sure
you won't need to roll back to a particular savepoint again, it can
be released, so the system can free some resources. Keep in mind
that rolling back to a savepoint will automatically release all
savepoints that were defined after it and releasing a savepoint
will automatically release all savepoints defined before it."

if not, could you please explain why this decision is made?
thanks,
Michael

If I do:

savepoint one;
update foo set bar = 2;
savepoint two;
update baz set foo = 3;
savepoint three;
delete from foo;

Why would it make sense to release "one" if i release "two"? If I
release "two", then it makes sense that I can never go back to "two"
or "three", but your proposed change means that if I release "two", I
can later rollback to "three" but not to "one". I don't see how
that's useful.

Essentially what the docs say is that savepoints are created on a
stack, and when you do something to to a savepoint "s", you
implicitly do the same thing to all the other savepoints above "s".
Or, if you think of them being nested:

savepoint one {
update foo set bar = 2;
savepoint two {
update baz set foo = 3;
savepoint three {
delete from foo;
...
}
...
}
...
}

then any operation on a savepoint also applies to any savepoints
nested within it.

#3Michael Cochez
michaelcochez@yahoo.com
In reply to: Phil Frost (#2)
Re: error in documentation?

My reasoning was :
Look to every query on a time line
savepoint 1
query 1
....
savepoint j
query j
.....
savepoint n
query n

When I release savepoint j , I think 'everythin before savepoint j is ok and safe', and so I don't need the savepoints before savepoint j anymore (cause they're save) when I do a rollback to savepoint j, I say 'everything done after savepoint j is rubbish' so I don't need the savepoints after j anymore

Lets say I release savepoint j, why wouldn't it make sense to go back to savepoint j+1, (a state after the state beeing released).
I tought of releasing a savepoint as 'everything up to that savepoint is ok, I'm not yet shure about the queries coming next'

Michael

Phil Frost <phil@macprofessionals.com> wrote:

If I do:

savepoint one;
update foo set bar = 2;
savepoint two;
update baz set foo = 3;
savepoint three;
delete from foo;

Why would it make sense to release "one" if i release "two"? If I
release "two", then it makes sense that I can never go back to "two"
or "three", but your proposed change means that if I release "two", I
can later rollback to "three" but not to "one". I don't see how
that's useful.

Essentially what the docs say is that savepoints are created on a
stack, and when you do something to to a savepoint "s", you
implicitly do the same thing to all the other savepoints above "s".
Or, if you think of them being nested:

savepoint one {
update foo set bar = 2;
savepoint two {
update baz set foo = 3;
savepoint three {
delete from foo;
...
}
...
}
...
}

then any operation on a savepoint also applies to any savepoints
nested within it.

---------------------------------
Catch up on fall's hot new shows on Yahoo! TV. Watch previews, get listings, and more!