From: | Rod Taylor <rbt(at)rbt(dot)ca> |
---|---|
To: | Curt Sampson <cjs(at)cynic(dot)net> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, snpe <snpe(at)snpe(dot)co(dot)yu>, "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: problem with new autocommit config parameter and jdbc |
Date: | 2002-09-11 02:17:53 |
Message-ID: | 1031710674.90974.22.camel@jester |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-jdbc |
On Tue, 2002-09-10 at 21:44, Curt Sampson wrote:
> But there were some issues with rolling back and SET commands,
> weren't there? I remember a long discussion about this that I'm
> not sure I want to go back to. :-)
So.. Unless explicitly requested, a SET command should have immediate
effect?
The other constrictive value I can think of is search_path.
-- Must be transaction safe
BEGIN;
CREATE SCHEMA <newschema>;
SET search_path = <newschema>;
ROLLBACK;
CREATE TABLE...
-- This should be ok
BEGIN;
SET autocommit = on;
INSERT ...
COMMIT;
-- SET takes place on commit, as it was an explicit transaction
-- This is requested behavior
SET autocommit = off;
SET autocommit = on;
INSERT... -- immediate effect, since autocommit is on
-- This gets interesting be ok as the schema must exist
SET autocommit = off;
CREATE SCHEMA <newschema>;
SET search_path = <newschema>; -- implicit commit here?
ROLLBACK;
CREATE TABLE ...
-- search_path must roll back or schema must have been created
-- Similar to the above
SET autocommit = off;
CREATE TABLE ...
SET autocommit = on; -- implicit commit here?
ROLLBACK;
-- Does this rollback anything?
-- Was CREATE TABLE committed with the second SET statement?
> Well, I'm not going to go chase it down right now, but ISTR that
> DECLAREing a cursor just allocates a variable name or the storage for it
> or something like that; it doesn't actually create an active cursor.
Indeed, this is how the cursor is able to cross transactions. It is
closed at transaction commit, and re-created in next use.
4.29:
For every <declare cursor> in an SQL-client module, a cursor is
effectively created when an SQLtransaction (see Subclause 4.32,
SQL-transactions ) referencing the SQL-client module is initiated.
--
Rod Taylor
From | Date | Subject | |
---|---|---|---|
Next Message | Curt Sampson | 2002-09-11 02:18:53 | Re: Optimization levels when compiling PostgreSQL... |
Previous Message | Bruce Momjian | 2002-09-11 02:12:31 | Re: [JDBC] problem with new autocommit config parameter |
From | Date | Subject | |
---|---|---|---|
Next Message | Barry Lind | 2002-09-11 02:48:51 | Re: [JDBC] problem with new autocommit config parameter |
Previous Message | Bruce Momjian | 2002-09-11 02:12:31 | Re: [JDBC] problem with new autocommit config parameter |