X-CGP-ClamAV-Result: CLEAN X-VirusScanner: Niversoft's CGPClamav Helper v1.22.2a (ClamAV engine v0.102.2) From: "D Tim Cummings" Received: from mail.triptera.com.au ([159.65.15.17] verified) by post.selbstdenker.com (CommuniGate Pro SMTP 6.3.7) with ESMTPS id 26713446 for webobjects-dev@wocommunity.org; Sun, 31 Oct 2021 00:47:49 +0200 Received-SPF: pass receiver=post.selbstdenker.com; client-ip=159.65.15.17; envelope-from=tim@triptera.com.au Received: from localhost (localhost [127.0.0.1]) by mail.triptera.com.au (Postfix) with ESMTP id 585C4182E77 for ; Sat, 30 Oct 2021 22:47:28 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at mail.triptera.com.au Received: from mail.triptera.com.au ([127.0.0.1]) by localhost (mail.triptera.com.au [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id k05BNiYbNzRz for ; Sat, 30 Oct 2021 22:47:23 +0000 (UTC) Message-ID: <323f2503-98aa-babc-3bc3-48b9fc564486@triptera.com.au> DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=triptera.com.au; s=201903; t=1635634043; bh=ISsRY9tkzEtmeBAhKbqPG68rhop5UJjcBjvYg1jnsoY=; h=Date:Subject:To:References:From:In-Reply-To:From; b=mEW6JEsw4/ss9mpgHdb1xXxy0/twJu4s7bD6fle8McvRcPidDME5puomlAhKDUTIH FmJV35XhFkCkM19iDiOiLNwnBfqByDTCEWUonGYQgz+6JfMqOOpPqOXUs0sOy9oRWB p8U5XkI044Vme/cO5stFL2/uBycpi7WPGWr51mBCEDd5oUFPbycSl5AUXIseuOw42H IH2XfOZonUpS/Wyic7APe7EhCjpcmozQK2BmrBWmEsvvKCK0NiiwdGBa3ECTHQb3IN bqlJvbpM79meuksMivMIEl08P/8q7PT1W+fwc+ewkFicoRw52PInt/XPr0eNaXG+1S iXMbttr4HtEcw== Date: Sun, 31 Oct 2021 08:47:22 +1000 MIME-Version: 1.0 Subject: Re: [WO-DEV] Re: Postgresql jdbc driver upgrade not recommended Content-Language: en-AU To: WebObjects & WOnder Development References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Thanks Ralf. I can confirm that 42.3.1 fixes the issue. Tim On 31/10/21 03:26, Ralf Schuchardt wrote: > There is a new driver version 42.3.1 fixing https://github.com/pgjdbc/pgjdbc/issues/2326, what looks like it is this issue. > > > On 30 Oct 2021, at 4:14, D Tim Cummings wrote: > >> I can reproduce the error in just a few lines of code. Is anyone else using Postgresql JDBC driver 42.3.0? >> >>     public void doRepeatSave() { >>       EOEditingContext ec = ERXEC.newEditingContext(); >>       // fetch the first record from database table tbl_person >>       TblPerson p = TblPerson.fetchTblPerson(ec, null); >>       BigDecimal bd150k = BigDecimal.valueOf(1500000000, 4); >>       for (int i=0; i < 10; i++) { >>         p.setDollarAmount(bd150k); >>         ec.saveChanges(); >>         logger.info("Count " + i + " p.dollarAmount=" + p.dollarAmount() ); >>       } >>     } >> >> After the sixth save (i=5) the value gets truncated.The first five times, saveChanges() doesn't even trigger an SQL "update" event. >> >> >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog -  === Begin Internal Transaction >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  - evaluateExpression: >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  - 1 row(s) processed >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  -  === Commit Internal Transaction >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  -  === Begin Internal Transaction >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  - evaluateExpression: >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  - 1 row(s) processed >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  -  === Commit Internal Transaction >> Oct. 30 12:04:07 wopg4230[56385] INFO com.triptera.demo.wopg4230.components.Main  - Count 0 p.dollarAmount=150000.0000 >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  -  === Begin Internal Transaction >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  - evaluateExpression: >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  - 1 row(s) processed >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  -  === Commit Internal Transaction >> Oct. 30 12:04:07 wopg4230[56385] INFO com.triptera.demo.wopg4230.components.Main  - Count 1 p.dollarAmount=150000.0000 >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  -  === Begin Internal Transaction >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  - evaluateExpression: >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  - 1 row(s) processed >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  -  === Commit Internal Transaction >> Oct. 30 12:04:07 wopg4230[56385] INFO com.triptera.demo.wopg4230.components.Main  - Count 2 p.dollarAmount=150000.0000 >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  -  === Begin Internal Transaction >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  - evaluateExpression: >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  - 1 row(s) processed >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  -  === Commit Internal Transaction >> Oct. 30 12:04:07 wopg4230[56385] INFO com.triptera.demo.wopg4230.components.Main  - Count 3 p.dollarAmount=150000.0000 >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  -  === Begin Internal Transaction >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  - evaluateExpression: >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  - 1 row(s) processed >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  -  === Commit Internal Transaction >> Oct. 30 12:04:07 wopg4230[56385] INFO com.triptera.demo.wopg4230.components.Main  - Count 4 p.dollarAmount=150000.0000 >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  -  === Begin Internal Transaction >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  - evaluateExpression: >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  - 1 row(s) processed >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  -  === Commit Internal Transaction >> Oct. 30 12:04:07 wopg4230[56385] INFO com.triptera.demo.wopg4230.components.Main  - Count 5 p.dollarAmount=15.0000 >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  -  === Begin Internal Transaction >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  - evaluateExpression: >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  -  === Commit Internal Transaction >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  -  === Begin Internal Transaction >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  - evaluateExpression: >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  - 1 row(s) processed >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  -  === Commit Internal Transaction >> Oct. 30 12:04:07 wopg4230[56385] INFO com.triptera.demo.wopg4230.components.Main  - Count 6 p.dollarAmount=15.0000 >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  -  === Begin Internal Transaction >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  - evaluateExpression: >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  -  === Commit Internal Transaction >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  -  === Begin Internal Transaction >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  - evaluateExpression: >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  - 1 row(s) processed >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  -  === Commit Internal Transaction >> Oct. 30 12:04:07 wopg4230[56385] INFO com.triptera.demo.wopg4230.components.Main  - Count 7 p.dollarAmount=15.0000 >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  -  === Begin Internal Transaction >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  - evaluateExpression: >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  -  === Commit Internal Transaction >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  -  === Begin Internal Transaction >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  - evaluateExpression: >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  - 1 row(s) processed >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  -  === Commit Internal Transaction >> Oct. 30 12:04:07 wopg4230[56385] INFO com.triptera.demo.wopg4230.components.Main  - Count 8 p.dollarAmount=15.0000 >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  -  === Begin Internal Transaction >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  - evaluateExpression: >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  -  === Commit Internal Transaction >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  -  === Begin Internal Transaction >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  - evaluateExpression: >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  - 1 row(s) processed >> Oct. 30 12:04:07 wopg4230[56385] DEBUG NSLog  -  === Commit Internal Transaction >> Oct. 30 12:04:07 wopg4230[56385] INFO com.triptera.demo.wopg4230.components.Main  - Count 9 p.dollarAmount=15.0000 >> >> On 29/10/21 20:00, D Tim Cummings wrote: >>> I have built a small app which demonstrates this behaviour. >>> >>> https://github.com/timcu/wopg4230 >>> >>> It is a very simple app with a database with one table with one record with one field (other than the primary key). The app has one WOComponent with one form with one text field and one save button. >>> >>> It is a maven app but that makes it easy to swap between jdbc driver versions. >>> >>> I would be interested if other people see the same behaviour. You will need to set up a postgresql database but I have put instructions on the github README.md on how to do that. >>> >>> Tim >>> >>> On 27/10/21 20:06, D Tim Cummings wrote: >>>> Postgresql data type : Numeric(38,4) allows null >>>> >>>> Java data type: BigDecimal >>>> >>>> EOModel using prototype: currencyAmount >>>> >>>> When number is first retrieved from database it has precision 10 scale 4 eg 150000.0000 >>>> >>>> I click the edit button which puts the number in a textfield which has numberformat "$#,##0; ($#,##0)" and it displays as $150,000 >>>> >>>> I click save button. Number in EO is now 150000 with precision 6 and scale 0 >>>> >>>> I run ec().saveChanges() where ec() is my editingContext. >>>> >>>> Number in EO is still 150000 with precision 6 and scale 0 >>>> >>>> I repeat the procedure "edit / save" several times and randomly the number in EO eventually becomes 15 with precision 2 and scale 0. If it happens before the saveChanges() then the new number gets saved to the database. However it can happen after the save in which case my app sees the small number but it doesn't get saved to database if I shutdown the app at that point and start it up again. >>>> >>>> It looks like a problem with my app except that it only started happening with the new JDBC driver and reverting the JDBC driver removes the problem. >>>> >>>> >>>> Tim >>>> >>>> >>>> On 27/10/21 18:48, Hugi Thordarson wrote: >>>>> Hi Tim, >>>>> out of curiosity, what's the data type of the number that's getting truncated? (both the DB and java/model side) >>>>> >>>>> - hugi >>>>> >>>>> >>>>>> On 27 Oct 2021, at 04:53, D Tim Cummings wrote: >>>>>> >>>>>> I just upgraded my postgresql jdbc driver from 42.2.23 to 42.3.0 and suddenly any number returned from the database that ended in four zeros was having the zeros trimmed. >>>>>> >>>>>> For example >>>>>> >>>>>> 150000 became 15 >>>>>> >>>>>> This did not affect numbers ending in three zeros >>>>>> >>>>>> 151000 stayed as 151000 >>>>>> >>>>>> I am still looking for the cause but rolling back to 42.2.23 fixed the problem. Problem was reproducible on Postgresql 10.18 on Ubuntu and Postgresql 13.3 on Mac. >>>>>> >>>>>> I am using Wonder 7.2 with Postgresql plugin. My project is defined using the maven structure. I was using the postgresql jdbc driver in my pom.xml with >>>>>> >>>>>> >>>>>>      org.postgresql >>>>>>      postgresql >>>>>>      42.2.23 >>>>>> >>>>>> >>>>>> Hope this helps >>>>>> >>>>>> Tim >>>>>> >>>>>> >>>>>> >>>>> ############################################################# >>>>> This message is sent to you because you are subscribed to >>>>>    the mailing list . >>>>> To unsubscribe, E-mail to: >>>>> To switch to the DIGEST mode, E-mail to >>>>> To switch to the INDEX mode, E-mail to >>>>> Send administrative queries to >>>>> >>>> ############################################################# >>>> This message is sent to you because you are subscribed to >>>>  the mailing list . >>>> To unsubscribe, E-mail to: >>>> To switch to the DIGEST mode, E-mail to >>>> To switch to the INDEX mode, E-mail to >>>> Send administrative queries to >>>> > ############################################################# > This message is sent to you because you are subscribed to > the mailing list . > To unsubscribe, E-mail to: > To switch to the DIGEST mode, E-mail to > To switch to the INDEX mode, E-mail to > Send administrative queries to >