Jaime Casanova <systemguards@gmail.com> writes:
> recently someone show us this code in the spanish list...
>> BEGIN WORK;
>> INSERT INTO mitabla VALUES (1);
>> BEGIN TRANSACTION;
>> INSERT INTO mitabla VALUES (2);
>> INSERT INTO mitabla VALUES (3);
>> COMMIT TRANSACTION;
>> INSERT INTO mitabla VALUES (4);
>> ROLLBACK WORK;
> he was expecting an empty table but instead he gets this:
> so, why BeginTransactionBlock emits just a warning and not an error?
I can't get real excited about this case. If the second BEGIN had
errored out, he'd *still* not get an empty table: the COMMIT would
end the aborted transaction, then the last INSERT would succeed,
then the ROLLBACK would complain about "no transaction in progress".
Maybe there's an argument for turning the warning into an error,
but this example doesn't provide it.
regards, tom lane