Received: from magus.postgresql.org ([87.238.57.229]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TBoTR-0003pF-Pv for pgsql-jdbc@postgresql.org; Wed, 12 Sep 2012 15:03:29 +0000 Received: from smtp102.prem.mail.ac4.yahoo.com ([76.13.13.41]) by magus.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TBoTL-0005aY-35 for pgsql-jdbc@postgresql.org; Wed, 12 Sep 2012 15:03:29 +0000 Received: (qmail 3431 invoked from network); 12 Sep 2012 15:03:21 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=DKIM-Signature:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:From:To:Cc:References:In-Reply-To:Subject:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:X-Mailer:Thread-Index:Content-Language; b=f3TPka9TEBQ4+KBIiFT3Y8xHQdfQuTSfMcrNIHL1X8Ho3YYI0eZ20ztzCw7Y80ouyBeC/+BtEzhiBrdkyh6wq4UOz54VWeJsKwl5Gtc0rKwXytuibn12FNearIbKshe9OuQpofxI1IWahHl6q+dPRbj2yyZZpLgx3u/4iDjAUpQ= ; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1347462201; bh=e5jk3sDiQbrQp/QkLWSjANLSiNs4VqFYT1BYJUufJU8=; h=X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:From:To:Cc:References:In-Reply-To:Subject:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:X-Mailer:Thread-Index:Content-Language; b=cNMKQ/bD1wuiRi7Gta/SV6koOTXduT3wxWxKWN1yF6gngZs40Xpot9QKvd6EjHKWnveS5/qlMooL6K5FBWDAaAUZmCbVGX/whmBOyxMPFZ5aqR01dgDbqOBq0dNbg4Wgx2Jut9vqhuezuaOpa8pRSm4NhMFBm1/w67IAxt3Jhcw= X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: N2WsEB8VM1kSYgIFo.xXCS4CmZYEcGi6fmQgtTOKuli7yr2 .7buYziEs83EDrNmR_v5sqAYRhSO4X83CK3.KAkbudTjTqcSwqD0Wg4Qtt3u 0W49.wbxIPCAjV7BLYak15F1irpKP4oTKcvl1xwCKQb9D0dM8AQOxrAELfCK ZTd5aCwGfPVU695jDqiflB5FW3foMwOCq5yhzvtMLHuoPJhMBtlp4m.9Ru2J eKRMCsAHUNgIrY55tPx7w_pOPgoH48ISW8cnevd67ErSUi_yKi3M_KiBliWh mXUOpAdE7WgmxOkzIOYrLba1uJ2Pjy6YkcgHyKguiVENK9jmjj40ZEXjjGqh EuDjRYihVThxE38_AKZWPedOITXPW1kJhqxz0jafSoRv_kXmdz01yBnijK0n w7Zs2PicW_4Zw8Z6Fokar_Ge2j382ANTob0b8 X-Yahoo-SMTP: mpGJl6eswBD2IBufoVEg0Pa8gg-- Received: from WolfDog (polobo@24.93.23.188 with login) by smtp102.prem.mail.ac4.yahoo.com with SMTP; 12 Sep 2012 15:03:21 +0000 UTC From: "David Johnston" To: "'Albe Laurenz'" , "'Florent Guillaume'" , "'Kevin Grittner'" Cc: "'DocSea - Patrice Delorme'" , References: <504F144C.20108@docsea.com> <504F0006020000250004A19B@gw.wicourts.gov> <032f01cd90f1$0d28d3f0$277a7bd0$@yahoo.com> In-Reply-To: Subject: Re: Bug : FAST_NUMBER_FAILED when getting NaN on BigDecimal Date: Wed, 12 Sep 2012 11:02:33 -0400 Message-ID: <033801cd90f7$a3e55510$ebafff30$@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQJspKfO7IO2mxQup5aMm9BveUG6aAMd0kYVANh/iK0CNj/dgwMNjIZ8lf7SS2A= Content-Language: en-us X-Pg-Spam-Score: -2.4 (--) X-Archive-Number: 201209/27 X-Sequence-Number: 23263 > -----Original Message----- > From: Albe Laurenz [mailto:laurenz.albe@wien.gv.at] > Sent: Wednesday, September 12, 2012 10:48 AM > To: David Johnston *EXTERN*; Florent Guillaume; Kevin Grittner > Cc: DocSea - Patrice Delorme; pgsql-jdbc@postgresql.org > Subject: RE: [JDBC] Bug : FAST_NUMBER_FAILED when getting NaN on > BigDecimal >=20 > David Johnston wrote: > >>>> It is impossible to fetch data when numeric value in database is > >>>> NaN >=20 > >>> How do you expect what you read to be represented in Java? >=20 > >> java.lang.Double.NaN I guess. >=20 > > If the driver returns NULL is these situations it could still = maintain > > internally whether the NULL is the result of a conversion of > > INF/-INF/NaN or whether the NULL was in the data itself. The driver > > could expose a "isNaN(), isPosInf(), and isNegInf() methods that the > > user could query upon seeing a NULL BigDecimal so that it knows the > "meaning" of the NULL. Backward compatibility only requires that the > BigDecimal is still returned, new features can be added. >=20 > I don't think that's a good idea. >=20 > Apart from the fact that a null pointer isn't a good representation = for an out- > of-bounds value, that would change the behaviour and might break > applications that expect the current behaviour. >=20 > I think it is OK to throw an exception if a value cannot be = represented, but it > should be a meaningful message. >=20 OK. So the API would be more along the lines of: "if you are concerned = with NaN/Infinity values you can poll the result first to see if the = returned value is valid or not. If the returned value is invalid and = the user tries to read the value they get their exception. If the user = sees that the value is invalid (from the polling) then they should = forego reading the value and instead interpret whatever invalid value is = indicated. An actual NULL would be a valid value." I am unsure exactly WHEN the exception in this case is thrown but if too = early then sub-classing BigDecimal is not possible since the exception = would preclude the object ever being created (for backwards = compatibility). Personally, I believe there needs to be some way to access this aspect = of the PostgreSQL numeric type but it is not something that, aside from = a desire for completeness, currently affects me. Even a more = fine-grained exception hierarchy (NaNException, = PositiveInfinityException, NegativeInfinityException) that the user = could catch on could be helpful (instead of having to perform string = manipulation of the error message). In any cases a non-standard class = would be necessary so whether the driver provides ones or it simply = provide information and requires the user to code whatever Class is = appropriate is an explicit decision to make. David J.