Re: "Fix" for INT8 literals being parsed as INT4 disqualifying index scan problem in JBoss ...
От | James Robinson |
---|---|
Тема | Re: "Fix" for INT8 literals being parsed as INT4 disqualifying index scan problem in JBoss ... |
Дата | |
Msg-id | 567D39D4-112C-11D8-A127-000A9566A412@socialserve.com обсуждение исходный текст |
Ответ на | Re: "Fix" for INT8 literals being parsed as INT4 disqualifying index scan problem in JBoss ... (Oliver Jowett <oliver@opencloud.com>) |
Список | pgsql-jdbc |
On Nov 6, 2003, at 6:09 PM, Oliver Jowett wrote: > There's a patch pending that should fix this problem .. it adds an > explicit > typecast to all literals that reflects the type provided to JDBC > (either > implied by the method used, or from the java.sql.Types value for > setObject()). So the above query actually turns into: > > SELECT COUNT(*) FROM foo WHERE (id=1234::int8) > > if you use setLong() or setObject(..., Types.BIGINT) to set the > parameter. > > This does break other cases (e.g. using setLong() when you actually > want an > int4 value) but it's necessary to get consistency between the PREPARE > and > non-PREPARE paths.. and it's almost an application error in this case > anyway. > This sounds like a good fix. It was unfortunate that the additional type info that the PreparedStatement knew was evaporating before it could be used by the backend to stop some maddness. JBoss does indeed use the setObject(..., Types.BIGINT) (see line 1278 of org.jboss.ejb.plugins.cmp.jdbc.JDBCUtil -- that was fun to ultimately track down), so that should keep it happy. Thanks! ---- James Robinson Socialserve.com
В списке pgsql-jdbc по дате отправления: