Thread: JDBC Postgres problem
We are having a very strange issue where for certain records, queries sent via JDBC return no results when the identical query via command line or pgadmin return non-null (expected) results. Example below. We are running 8.3.9.
>> SELECT client_id FROM locations WHERE external_id = '278';
>>
>> Doing an EXPLAIN ANALYZE from psql gives:
>>
>> Seq Scan on locations (cost=0.00..17.01 rows=1 width=4) (actual
>> time=0.189..0.197 rows=1 loops=1)
>> Filter: ((external_id)::text = '278'::text) Total runtime: 0.245
>> ms
>>
>> And doing the same thing from JDBC stmt.executeQuery() gives:
>>
>> Seq Scan on locations (cost=0.00..17.93 rows=1 width=4) (actual
>> time=0.206..0.206 rows=0 loops=1)
>> Filter: ((external_id)::text = '278'::text) Total runtime: 0.221 ms
Note the 0 rows returned via JDBC. Has anyone ever heard of anything like this before?
Thanks,
Tyler Hains
IT Director
ProfitPoint, Inc.
On 9/07/2010 5:24 AM, Tyler Hains wrote: > We are having a very strange issue where for certain records, queries > sent via JDBC return no results when the identical query via command > line or pgadmin return non-null (expected) results. Example below. We > are running 8.3.9. Can you post a compilable, self-contained Java program and a database dump that demonstrates this problem? You might find that, in the course of trying to simplify your current code down to something you can publish, you discover what the issue is. If you still have the issue with a small, simplified example then please post it so it can be investigated. -- Craig Ringer
> We are having a very strange issue where for certain records, queries > sent via JDBC return no results when the identical query via command > line or pgadmin return non-null (expected) results. Example below. We > are running 8.3.9. We found our problem. It turned out to be a config file that was pointing to a stale copy of the db.
On 09/07/10 21:36, Tyler Hains wrote: >> We are having a very strange issue where for certain records, queries >> sent via JDBC return no results when the identical query via command >> line or pgadmin return non-null (expected) results. Example below. We >> are running 8.3.9. > > We found our problem. It turned out to be a config file that was > pointing to a stale copy of the db. Thanks very much for following up to the list with the resolution of your issue. I'm glad you found out what was going on. -- Craig Ringer