James Robinson <jlrobins@socialserve.com> writes:
> The JDBC interface exposes the savepoint interface, via setSavepoint(),
> releaseSavepoint(), and rollback(Savepoint sp) methods on the
> Connection, and Thomas's design of PL/Java offers the SPI via mapping
> it onto JDBC. Would client-side JDBC also suffer from the same
> potential issue of 'commit a savepoint made by a sub-function'?
No, it's not a problem for client-side JDBC, because that's executing in
a client thread that's not going to have its state affected by telling
the server to roll back some work. The fundamental problem on the
server side is keeping rollback from wiping your execution stack and
local variables out from under you :-(.
> Or is this something SPI-specific?
AFAICS the same problem would occur whether the PL used SPI or not;
certainly bypassing SPI to use the database engine more directly
wouldn't solve it.
regards, tom lane