On 1/19/07, Tom Lane <[EMAIL PROTECTED]> wrote:
"Merlin Moncure" <[EMAIL PROTECTED]> writes:
> I suspect the savepoint command is almost never used
> outside of oracle compatibility efforts.
Last I heard, we implemented it because it is in the SQL standard.
I have no idea (nor do I much care) whether it's oracle-compatible.
Not exactly. You haven't even made clear what you think that means,
let alone how it would be implemented. What context is foo() supposed
to be executed in? What happens if it fails?
right. I understand this is a nonstandard extension so the bar is
pretty high here...well, my thought was that the subtransaction could
be rolled back and foo executed in the parent transaction. In the
very early implementation of NT you could push and pop transactions
from a stack via multiple begin/end. so, in those terms the
equivalent would be:
BEGIN; -- savepoint x
FOO(); -- called if x fails only
if foo() fails, the whole transaction is failed because that pops the
outer transaction and with savepoints you can only be one level deep.
On 1/20/07, Dennis Bjorklund <[EMAIL PROTECTED]> wrote:
Isn't the problem that you try to use psql for scripting and it doesn't
have usual scripting power like branching (if) or looping (while,for)
that most scripting languages have. If there was say an \if command in
psql you could do things like this:
To be honest, I'm not a huge fan of psql tricks (error recovery being
another example) but this could provide a solution. in your opnion,
how would you use \if to query the transaction state?
---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?