The following bug has been logged online: Bug reference: 1192 Logged by: oliver dauben (adc hofheim)
Email address: [EMAIL PROTECTED] PostgreSQL version: 7.4 Operating system: any (tested w/ win NT, win XP, linux 2.4.x) Description: JDBC driver: org.postgresql.jdbc2.Array throws Bad BigDecimal Exception Details: i'm working with NUMERIC(32,16) arrays in a DB table. psql retrieval works without any problems. nevertheless, JDBC retrieval causes a 'Bad BigDecimal Exception' beeing thrown for cases when there are non- integer values in the corresponding array. in other words there is no problem getting a "3.0, 4.0, 5.0" array back into java but "3.1, 4.1, 5.1" will throw a BBDE. this behaviour is exposed - at least - by the postgresql 7.3 and the latest production grade 7.4 JDBC drivers. i traced things down to the 'org.postgresql.jdbc2.Array' class where i found a line reading AbstractJdbc2ResultSet.toBigDecimal( arrayContents[(int)index++], 0 ); in the switch/case of the base tyope for Type.NUMERIC. initializing a java BigDecimal with a scale of '0' (the second argument in the method call) causes an exception because for example "3.1" cannot be exactly represented by a BigDecimal with scale '0'. FIX PROPOSAL: changing the scale to '-1' ('autoscale') will allow for proper casts agains BigDecimal and works fine for me: AbstractJdbc2ResultSet.toBigDecimal( arrayContents[(int)index++], -1 ); hope this helps, cheers, oLiVeR. ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html