Thread: Patch for handling "autocommit=false" in postgresql.conf
Hello, This is patch for handle JDBC for autocommit=false in postgresql.conf Patch set autocommit mode to true (on) for JDBC compliant. --- AbstractJdbc1Connection.java.orig Tue Sep 17 02:23:49 2002 +++ AbstractJdbc1Connection.java Tue Sep 17 02:27:52 2002 @@ -366,6 +366,11 @@ // Initialise object handling initObjectTypes(); + // handle autocommit=false in postgresql.conf + if (haveMinimumServerVersion("7.3")) { + ExecSQL("set autocommit to on; commit;"); + } + // Mark the connection as ok, and cleanup PG_STATUS = CONNECTION_OK; } regards Haris Peco
snpe <snpe@snpe.co.yu> writes: > + // handle autocommit=false in postgresql.conf > + if (haveMinimumServerVersion("7.3")) { > + ExecSQL("set autocommit to on; commit;"); > + } The above will fill people's logs with WARNING: COMMIT: no transaction in progress if they don't have autocommit off. Use begin; set autocommit to on; commit; instead. I would recommend holding off on this patch altogether, actually, until we decide whether SET will be a transaction-initiating command or not. I would still like to persuade the hackers community that it should not be. regards, tom lane
On Tuesday 17 September 2002 04:26 pm, Tom Lane wrote: > snpe <snpe@snpe.co.yu> writes: > > + // handle autocommit=false in postgresql.conf > > + if (haveMinimumServerVersion("7.3")) { > > + ExecSQL("set autocommit to on; commit;"); > > + } > > The above will fill people's logs with > WARNING: COMMIT: no transaction in progress > if they don't have autocommit off. > > Use > begin; set autocommit to on; commit; > instead. > > I would recommend holding off on this patch altogether, actually, > until we decide whether SET will be a transaction-initiating > command or not. I would still like to persuade the hackers community > that it should not be. if set 'begin; setautocommit to on; commit;' this is work no matter autocommit on or off and whether SET initiate transaction or not. We can yet query database for transaction (on or off), but this is not important (we must autocommit=true for jdbc spec). regards haris peco
Tom Lane wrote: > snpe <snpe@snpe.co.yu> writes: > > + // handle autocommit=false in postgresql.conf > > + if (haveMinimumServerVersion("7.3")) { > > + ExecSQL("set autocommit to on; commit;"); > > + } > > The above will fill people's logs with > WARNING: COMMIT: no transaction in progress > if they don't have autocommit off. > > Use > begin; set autocommit to on; commit; > instead. > > I would recommend holding off on this patch altogether, actually, > until we decide whether SET will be a transaction-initiating > command or not. I would still like to persuade the hackers community > that it should not be. Sorry to be blocking that change but I can see no reason to special case SET to not start a new transaction, especially since we added SET to be rollbackable in 7.3. If we hadn't done that, you easily could make a case for it because the SET would behave without transaction semantics. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073