Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TBnjk-0007n0-55 for pgsql-jdbc@postgresql.org; Wed, 12 Sep 2012 14:16:16 +0000 Received: from smtp109.prem.mail.ac4.yahoo.com ([76.13.13.92]) by magus.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TBnjh-0004sp-5Q for pgsql-jdbc@postgresql.org; Wed, 12 Sep 2012 14:16:15 +0000 Received: (qmail 48336 invoked from network); 12 Sep 2012 14:16:11 -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=5a3TN8VUfBWXZ2fFR60SFOHrDDsJM8xE7l8S5Xu0xCK0EUP8jOmnbfuAKX/hVYXR0hBXE7vSlzG6g975n9BEloTjbFrXFDIMPxwhn0q+bwq/9CsrZ6cc9wDJj5dNJgKo2wlBORHz29NmQtuuY6kICmCtNWRwQE2QEogNTOKyZDY= ; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1347459371; bh=tZn7LYqFIyUFIRC1NIIFEriVyDQej9fz9J2zSmrMmjw=; 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=HLwJAzIdvSG9u/P78T40vu/4Gj6/30FoOe0f/1c5fCNbNPtjzwIY2i4gMl0UR0ppEh7o5FfI+J/N0rZ5vidyEy/xTTKimElm1/VHUFwscZcCdqQLqoGD7rtToNeCSCNgCHK2HTqihAnSc3uhT2UAVvyXJEBBPg8eXEO0nz0nPhM= X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: 2y.ZEWYVM1mnXHkTuakRL1jLQz4wihCDAjLJwQU7jJCrFKp pE5gIcPaA24fkxdDHdH9Gq9NbAjwaHDKPanLdY13Z7vUpGvJLdNy1VCP_Rz5 Xzpkf72rkcuwt0ehKG4IqOIATmIQ_UYSFjPUJ8Ij9QxAmzWs0GsvhqbyP5ch 3fdWZp8DK6oribdxu1.ljq3x_pJoJ4r5JQgBJK73EC686F83GLdd04omOlrI FK3WOTgndKq6VMSgrfl1v3oeTbsco40Ih8QUHiuGXFUhe35Qxt_.Gnx59Um5 RNsM6QefV3gsUw8qTzs2lPbAQoV3vJAzDT.PNwTx7r7.Pr.6HJ34CXHfvKy_ Ex9.vDFbGgHXpOC07PJG0MGRKrBefsDt1yVkfEojpaMlKEPY1E9AsLy1X.D0 cgS1Cr6LsgdC3VjSnMOJOngQ6Z7XBBhdUFPxb X-Yahoo-SMTP: mpGJl6eswBD2IBufoVEg0Pa8gg-- Received: from WolfDog (polobo@24.93.23.188 with login) by smtp109.prem.mail.ac4.yahoo.com with SMTP; 12 Sep 2012 07:16:11 -0700 PDT From: "David Johnston" To: "'Florent Guillaume'" , "'Kevin Grittner'" Cc: "'DocSea - Patrice Delorme'" , References: <504F144C.20108@docsea.com> <504F0006020000250004A19B@gw.wicourts.gov> In-Reply-To: Subject: Re: Bug : FAST_NUMBER_FAILED when getting NaN on BigDecimal Date: Wed, 12 Sep 2012 10:15:24 -0400 Message-ID: <032f01cd90f1$0d28d3f0$277a7bd0$@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/iK2WKOFHoA== Content-Language: en-us X-Pg-Spam-Score: -2.4 (--) X-Archive-Number: 201209/22 X-Sequence-Number: 23258 > -----Original Message----- > From: pgsql-jdbc-owner@postgresql.org [mailto:pgsql-jdbc- > owner@postgresql.org] On Behalf Of Florent Guillaume > Sent: Wednesday, September 12, 2012 9:36 AM > To: Kevin Grittner > Cc: DocSea - Patrice Delorme; pgsql-jdbc@postgresql.org > Subject: Re: [JDBC] Bug : FAST_NUMBER_FAILED when getting NaN on > BigDecimal >=20 > On Tue, Sep 11, 2012 at 4:10 PM, Kevin Grittner > wrote: > > DocSea - Patrice Delorme wrote: > > > >> It is impossible to fetch data when numeric value in database is = NaN > >> It throws FAST_NUMBER_FAILED > >> (postgresql-jdbc-9.1-902:AbstractJdbc2ResultSet:2176) because my > >> value is not numeric (NaN). > >> This is incorect behaviour since 'NaN' is a legal value in postgres > >> for numeric type. > > > > How do you expect what you read to be represented in Java? >=20 > java.lang.Double.NaN I guess. >=20 >=20 I would think returning a special "Double" value when the expected = datatype is "BigDecimal" would cause problems. I would expect it to = return NULL since that is the closest you are going to get to the = semantic meaning of NaN with the existing BigDecimal class. Maybe someone would a add a class to the JDBC driver that is a sub-class = of BigDecimal with infinity and NaN query/representation features but = since BigDecimal does not have them, and for backwards compatibility = number-to-BigDecimal has to remain, there really isn't any better = option. Well, there is one. 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. You either need to cast to a "float" in PostgreSQL so that the result is = stored into a "Double" in Java or figure out some other application = specific workaround. David J.