Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id A65CB1337C69 for ; Wed, 6 Apr 2011 13:09:22 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 51117-01 for ; Wed, 6 Apr 2011 16:09:03 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from web33208.mail.mud.yahoo.com (web33208.mail.mud.yahoo.com [209.191.69.156]) by mail.postgresql.org (Postfix) with SMTP id DCA8B1337C29 for ; Wed, 6 Apr 2011 13:07:29 -0300 (ADT) Received: (qmail 62166 invoked by uid 60001); 6 Apr 2011 16:07:28 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1302106048; bh=V8oBLd9m7BIAmKOnWgG2fEO4j1Ts6relpDeZD59hFLw=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:Cc:In-Reply-To:MIME-Version:Content-Type; b=JgeZnV6wih28ILp1C2IHMoc1uW547nf4PLmDJJYqHadUkLIpdDu4WG93dccu/65aSK/hG98f54KfJY04onhVrnRxvW6cFZK0GW8CFqSM8iqS9s42OZJ/gaMyF2YVDHmxnaUQnk0Zb1F/Fa6EggvCp+SvWUAN80LRydgx+/8MwME= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:Cc:In-Reply-To:MIME-Version:Content-Type; b=R2LnhB+tkPkcEbC7v0lPBazGC2BnAbvZb5W8tdDa/dlY8v1nIFX0MiurnjdmrDvgh9HB3uieX5QC3FDRMsWndf7k8FgkhT7M++4A5jQmftI3Zi7mlEr3Eq2KElC4RYUQXK6HDjCj6rFZCm24MFeAlRDVD8qyHhSP1bi15ubqFS4=; Message-ID: <678556.87919.qm@web33208.mail.mud.yahoo.com> X-YMail-OSG: X3kyg00VM1lLD9VCxZNYwYb8zsyGPJ4uUgWks68jF27Xu62 5b3nY0pHunlyME40PLkRI9aiviTSuYRmpwo2XMkj7Urf4XQ9x5zz.TLPv_Jw uS9o04bye1d8D1xHayGMbCPaiAb5VgftyHCdVSyl_efrdF22hcbZH0bUcZue A2EoIGvfjVAP1FVH652iR0sSEDNkP1qkPPxIagyFCw7BG6ua.7LUx5VMLwtx ur8Tp.6tKmaePSXL41TwiDw7Ur2P_hfSSJymxqevqsknUebjFhaecjByNao3 sAnN5vc2molzmolM.KXysc01.EVA0gvWf56DVZvEmFRRoQvmQ8jNLzMJBaJC sgRCBU7QoH1LHjh1xyIaUKDU9d3igxsjJI_1pMsSuiJHRRmXuwwa77Fwct6k hgiZqviQXEMiF Received: from [199.84.5.210] by web33208.mail.mud.yahoo.com via HTTP; Wed, 06 Apr 2011 09:07:28 PDT X-Mailer: YahooMailClassic/12.0.2 YahooMailWebService/0.8.109.295617 Date: Wed, 6 Apr 2011 09:07:28 -0700 (PDT) From: Quartz Subject: Re: JDBC gripe list (the autocommit subthread) Cc: pgsql-jdbc@postgresql.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.877 tagged_above=-10 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, MISSING_HEADERS=1.021, RCVD_IN_DNSWL_NONE=-0.0001, RFC_ABUSE_POST=0.001, T_RP_MATCHES_RCVD=-0.01, T_TO_NO_BRKTS_FREEMAIL=0.01 X-Spam-Level: X-Archive-Number: 201104/38 X-Sequence-Number: 21764 I posted that the remaining question is not about how and why it is used. It is about the fact that with autocommit=true, when a the first statement to fail is in the middle of a batch, all previous statement are supposed to be completed and NOT rolled back (regardless of the other statement at or after the failed statement). > (a) it would be quite a lot of extra work to wrap each > statement in a separate transaction (we'd have to send explicit BEGIN/END > around each statement execution; > (c) usually batch updates are there for performance > reasons, which is at odds with creating a separate transaction for each > batched statement; It is not about performance. It is about behavior. > (d) the current behavior *is* allowed by the > specification. Not it isn't. (see top of message.) --- On Thu, 3/31/11, Oliver Jowett wrote: > From: Oliver Jowett > Subject: Re: [JDBC] JDBC gripe list (the autocommit subthread) > To: "Quartz" > Cc: "Kevin Grittner" , pgsql-jdbc@postgresql.org > Received: Thursday, March 31, 2011, 6:32 PM > On 1 April 2011 10:34, Quartz > wrote: > > > You have been defending all that long that most use > the autocommit=false when using batches. Then they won't > break....! > > > > Besides that's what release notes are for. And I dare > say, if they expected a transaction when using a batch with > autocommit=true, it about time they learn their mistake. > JDBC api is a contract. Can't make exception for postgres. > > The JDBC spec says that the behavior of executeBatch() > with > autocommit=true is implementation defined, and specifically > warns > against using it with autocommit on. > > I don't see any problems with the driver's current > behavior: > > (a) it would be quite a lot of extra work to wrap each > statement in a > separate transaction (we'd have to send explicit BEGIN/END > around each > statement execution; > (b) the current behavior is consistent with how multiple > statement > execution works elsewhere in the driver, where if you > execute "SELECT > a; SELECT b" as a statement with autocommit=true then the > two queries > run in a single transaction; > (c) usually batch updates are there for performance > reasons, which is > at odds with creating a separate transaction for each > batched > statement; > (d) the current behavior *is* allowed by the > specification. > > The problem is with your code relying on particular > behavior of > executeBatch() + autocommit, which the spec explicitly > warns is > implementation-defined behavior that you shouldn't rely > on. > > Oliver >