Re: Curious behaviour with Execute Batch and Prepared Statements

From: Brett Walker <brett(dot)walker(at)geometryit(dot)com>
To: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Curious behaviour with Execute Batch and Prepared Statements
Date: 2012-06-25 10:23:41
Message-ID: 4B95BC7335A13A42AD0D23462F91AE6F6163F67060@echo.geometryit.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc


Thanks Craig.

It was a bug. After spending a day away from the code and then looking at it for half an hour all refreshed I saw the bug that I had introduced. See the stackoverflow question.

Thanks agian for all your comments.

Brett
________________________________________
From: Craig Ringer [ringerc(at)ringerc(dot)id(dot)au]
Sent: Monday, 25 June 2012 2:34 PM
To: Brett Walker
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: [JDBC] Curious behaviour with Execute Batch and Prepared Statements

On 06/24/2012 01:58 PM, Brett Walker wrote:

I have a problem that I have described on stackoverflow. It is here: http://stackoverflow.com/questions/11167471/curious-behaviour-with-executebatch-and-prepared-statements

OK, so you've set log_statement = 'all' and restarted or reloaded Pg, re-run your test, and you still don't see the statement hitting the DB? You've possibly found a bug. Now you need to narrow it down.

Does this fail if you run the same statement against 9.1? ie is it specifically a PgJDBC 9.1 vs PostgreSQL 8.3 issue? Or does it happen irrespective of the version of PostgreSQL being targeted? Does the issue exist in older versions of PgJDBC too?

Try enabling detailed logging in PgJDBC and see if you can make out what's going wrong. See: http://jdbc.postgresql.org/documentation/91/connect.html#connection-parameters and 'loglevel' .Set loglevel = 2 in the JDBC driver and re-run your tests.

If that doesn't help: Grab the PgJDBC sources. Attach a debugger to the test and step through the problem statement execution. Watch what PgJDBC is doing, see where it goes wrong.

If you don't want to do all that: Create a self-contained test case as a standalone Java program (source, ant or maven build, all dependencies, etc) that can simply be downloaded and run against a clean PostgreSQL database to demonstrate your problem. You'll want to provide a .sql script to set up the test environment by populating the database too.

--
Craig Ringer

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Robert Jacoby 2012-06-26 17:21:06 Forward compatibility of drivers
Previous Message Craig Ringer 2012-06-25 04:34:25 Re: Curious behaviour with Execute Batch and Prepared Statements