Обсуждение: ResultSet.getObject returning PGobject
PostgreSQL Native Driver PostgreSQL 8.1 JDBC3 with SSL (build 404) against 8.1.0 I don't have a reproducible test case, and the messages from the software are not providing a lot of data, but out of a run with millions of invocations of ResultSet.getObject, five of those returned an object of class org.postgresql.util.PGobject. As far as I can see, this would have to be a bug in the JDBC driver. I'm still trying to chase it down, but I thought I should post here to give everyone a heads up, and possibly get some suggestions. -Kevin
On Fri, 18 Nov 2005, Kevin Grittner wrote: > I don't have a reproducible test case, and the messages from the > software are not providing a lot of data, but out of a run with millions > of invocations of ResultSet.getObject, five of those returned an object > of class org.postgresql.util.PGobject. As far as I can see, this would > have to be a bug in the JDBC driver. I'm still trying to chase it down, > but I thought I should post here to give everyone a heads up, and > possibly get some suggestions. > It is expected that the driver will return a PGobject if there underlying column data is of a type not directly mappable to a Java type, and if there is a pg specific java type configured in the driver. Traditionally we've had additional support for some of the geometric types, but if this is something new I would guess it would be the added support in 8.1 for the interval datatype. Kris Jurka
Kevin Grittner wrote: > Ah, that may be a good clue. > > We are not selecting any columns which are not directly mappable > to a Java type -- at least not intentionally. There is a problem with > a JDBC escape sequence which is not implemented by PostgreSQL > which is throwing some exceptions, which we are still cleaning up. > Perhaps the syntax is occassionally being interpreted in some way > which is causing this. I'll suspend this issue until we get the other > cleaned up and see if we still have this problem. What escape sequence is that? We could look at implementing it. > This is happening on a SELECT where the result set consists entirely > of simple references to columns from a single table. The columns are > all char, varchar, numeric, or int -- so they should all map to Java > types. It is happening on a small percentage of SELECTs with no > apparent difference beyond the values used in otherwise identical > WHERE clauses. > I see no reason why the WHERE clause would alter the type of a result column. Checking: Object o = rs.getObject(col); if (o instanceof PGobject) { System.err.println(((PGobject)o).getType()); System.err.println(((PGobject)o).getValue()); } or similar would tell you what the returned type was. Kris Jurka