Re: problem with stored procedure ,transaction and jdbc

From: Kris Jurka <books(at)ejurka(dot)com>
To: Andres Ledesma <aledes(at)euskalnet(dot)net>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: problem with stored procedure ,transaction and jdbc
Date: 2005-08-12 18:36:05
Message-ID: Pine.BSO.4.62.0508121333130.14258@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Fri, 12 Aug 2005, Andres Ledesma wrote:

> have you considered to enclose both stored procedures in a transaction inside
> another stored procedure, and call just one from the java code, something
> like :
>
> CREATE FUNCTION stored_procedure_3()....
> BEGIN;
> BEGIN TRANSACTION;
> PERFORM .. call strored procedure 1
> PERFORM .. call strored procedure 2
> COMMIT;
> END;
> ' LANGUAGE plpgsql;
>

Postgresql does not allow transactions to be started/stopped inside of a
backend function. It does support savepoints which do allow work to be
saved and rolled back to, but the function call is still wrapped in an
outer transaction. For the example above leaving the BEGIN
TRANSACTION/COMMIT off may give you the behavior desired (because the
query itself is wrapped in a transaction).

Kris Jurka

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2005-08-12 18:44:04 Re: Timestamp changes committed to HEAD
Previous Message Kris Jurka 2005-08-12 18:26:23 Re: Memory leak in 8.0 JDBC driver?