pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Curious behaviour with Execute Batch and Prepared Statements
7+ messages / 3 participants
[nested] [flat]

* Curious behaviour with Execute Batch and Prepared Statements
@ 2012-06-24 05:58  Brett Walker <brett.walker@geometryit.com>
  0 siblings, 2 replies; 7+ messages in thread

From: Brett Walker @ 2012-06-24 05:58 UTC (permalink / raw)
  To: pgsql-jdbc

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

I don't want to provide the detail here as I think it is too long.

Comments or questions are appreciated.

Brett

Brett Walker <brett.walker@geometryit.com<mailto:brett.walker@geometryit.com>>
Software Developer / Analyst
Geometry Pty Ltd

Telephone            03 6223 1999
Mobile                   0458 498 386
Fax                          03 6223 1988
Web                        www.geometryit.com<http://www.geometryit.com/;
Address                                 31 Salamanca Square, Battery Point, TAS 7004, Australia

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Curious behaviour with Execute Batch and Prepared Statements
@ 2012-06-24 11:09  Dave Cramer <pg@fastcrypt.com>
  parent: Brett Walker <brett.walker@geometryit.com>
  1 sibling, 1 reply; 7+ messages in thread

From: Dave Cramer @ 2012-06-24 11:09 UTC (permalink / raw)
  To: Brett Walker <brett.walker@geometryit.com>; +Cc: pgsql-jdbc

Brett,

Does it work with a recent version of postgresql ? 8.3 is quite old

Dave Cramer

dave.cramer(at)credativ(dot)ca
http://www.credativ.ca


On Sun, Jun 24, 2012 at 1:58 AM, Brett Walker
<brett.walker@geometryit.com> 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-stateme...
>
>
>
> I don’t want to provide the detail here as I think it is too long.
>
>
>
> Comments or questions are appreciated.
>
>
>
> Brett
>
>
>
> Brett Walker <brett.walker@geometryit.com>
>
> Software Developer / Analyst
>
> Geometry Pty Ltd
>
>
>
> Telephone            03 6223 1999
>
> Mobile                   0458 498 386
>
> Fax                          03 6223 1988
>
> Web                        www.geometryit.com
>
> Address                                 31 Salamanca Square, Battery Point,
> TAS 7004, Australia
>
>



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Curious behaviour with Execute Batch and Prepared Statements
@ 2012-06-24 11:26  Brett Walker <brett.walker@geometryit.com>
  parent: Dave Cramer <pg@fastcrypt.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Brett Walker @ 2012-06-24 11:26 UTC (permalink / raw)
  To: pgsql-jdbc

Hi Dave,

I'm aware that 8.3 is old. I was trying to run a regression test.

If it is not supported on 8.3 that is fine but I cannot find any documentation to say that.

I am using a recent JDBC driver version. Hoping that would cover it.

Brett
________________________________________
From: davecramer@gmail.com [davecramer@gmail.com] On Behalf Of Dave Cramer [pg@fastcrypt.com]
Sent: Sunday, 24 June 2012 9:09 PM
To: Brett Walker
Cc: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] Curious behaviour with Execute Batch and Prepared Statements

Brett,

Does it work with a recent version of postgresql ? 8.3 is quite old

Dave Cramer

dave.cramer(at)credativ(dot)ca
http://www.credativ.ca


On Sun, Jun 24, 2012 at 1:58 AM, Brett Walker
<brett.walker@geometryit.com> 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-stateme...
>
>
>
> I don’t want to provide the detail here as I think it is too long.
>
>
>
> Comments or questions are appreciated.
>
>
>
> Brett
>
>
>
> Brett Walker <brett.walker@geometryit.com>
>
> Software Developer / Analyst
>
> Geometry Pty Ltd
>
>
>
> Telephone            03 6223 1999
>
> Mobile                   0458 498 386
>
> Fax                          03 6223 1988
>
> Web                        www.geometryit.com
>
> Address                                 31 Salamanca Square, Battery Point,
> TAS 7004, Australia
>
>



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Curious behaviour with Execute Batch and Prepared Statements
@ 2012-06-24 13:22  Dave Cramer <pg@fastcrypt.com>
  parent: Brett Walker <brett.walker@geometryit.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Dave Cramer @ 2012-06-24 13:22 UTC (permalink / raw)
  To: Brett Walker <brett.walker@geometryit.com>; +Cc: pgsql-jdbc

Brett,

Clearly we can't document every use case with every version of the
driver and server.


Dave Cramer

dave.cramer(at)credativ(dot)ca
http://www.credativ.ca


On Sun, Jun 24, 2012 at 7:26 AM, Brett Walker
<brett.walker@geometryit.com> wrote:
> Hi Dave,
>
> I'm aware that 8.3 is old. I was trying to run a regression test.
>
> If it is not supported on 8.3 that is fine but I cannot find any documentation to say that.
>
> I am using a recent JDBC driver version. Hoping that would cover it.
>
> Brett
> ________________________________________
> From: davecramer@gmail.com [davecramer@gmail.com] On Behalf Of Dave Cramer [pg@fastcrypt.com]
> Sent: Sunday, 24 June 2012 9:09 PM
> To: Brett Walker
> Cc: pgsql-jdbc@postgresql.org
> Subject: Re: [JDBC] Curious behaviour with Execute Batch and Prepared Statements
>
> Brett,
>
> Does it work with a recent version of postgresql ? 8.3 is quite old
>
> Dave Cramer
>
> dave.cramer(at)credativ(dot)ca
> http://www.credativ.ca
>
>
> On Sun, Jun 24, 2012 at 1:58 AM, Brett Walker
> <brett.walker@geometryit.com> 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-stateme...
>>
>>
>>
>> I don’t want to provide the detail here as I think it is too long.
>>
>>
>>
>> Comments or questions are appreciated.
>>
>>
>>
>> Brett
>>
>>
>>
>> Brett Walker <brett.walker@geometryit.com>
>>
>> Software Developer / Analyst
>>
>> Geometry Pty Ltd
>>
>>
>>
>> Telephone            03 6223 1999
>>
>> Mobile                   0458 498 386
>>
>> Fax                          03 6223 1988
>>
>> Web                        www.geometryit.com
>>
>> Address                                 31 Salamanca Square, Battery Point,
>> TAS 7004, Australia
>>
>>
>
> --
> Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-jdbc



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Curious behaviour with Execute Batch and Prepared Statements
@ 2012-06-24 13:44  Brett Walker <brett.walker@geometryit.com>
  parent: Dave Cramer <pg@fastcrypt.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Brett Walker @ 2012-06-24 13:44 UTC (permalink / raw)
  To: pgsql-jdbc

Hi Dave,

Is it your feelling that PostgreSQL 8.3 can't support this functionality, even with a recent JDBC driver?

It's fine if it can't. Some sort of error Java side or warning in the db log would have been helpful. I was getting nothing only a curious side effect. It didn't make sense.

Brett
________________________________________
From: davecramer@gmail.com [davecramer@gmail.com] On Behalf Of Dave Cramer [pg@fastcrypt.com]
Sent: Sunday, 24 June 2012 11:22 PM
To: Brett Walker
Cc: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] Curious behaviour with Execute Batch and Prepared Statements

Brett,

Clearly we can't document every use case with every version of the
driver and server.


Dave Cramer

dave.cramer(at)credativ(dot)ca
http://www.credativ.ca


On Sun, Jun 24, 2012 at 7:26 AM, Brett Walker
<brett.walker@geometryit.com> wrote:
> Hi Dave,
>
> I'm aware that 8.3 is old. I was trying to run a regression test.
>
> If it is not supported on 8.3 that is fine but I cannot find any documentation to say that.
>
> I am using a recent JDBC driver version. Hoping that would cover it.
>
> Brett
> ________________________________________
> From: davecramer@gmail.com [davecramer@gmail.com] On Behalf Of Dave Cramer [pg@fastcrypt.com]
> Sent: Sunday, 24 June 2012 9:09 PM
> To: Brett Walker
> Cc: pgsql-jdbc@postgresql.org
> Subject: Re: [JDBC] Curious behaviour with Execute Batch and Prepared Statements
>
> Brett,
>
> Does it work with a recent version of postgresql ? 8.3 is quite old
>
> Dave Cramer
>
> dave.cramer(at)credativ(dot)ca
> http://www.credativ.ca
>
>
> On Sun, Jun 24, 2012 at 1:58 AM, Brett Walker
> <brett.walker@geometryit.com> 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-stateme...
>>
>>
>>
>> I don’t want to provide the detail here as I think it is too long.
>>
>>
>>
>> Comments or questions are appreciated.
>>
>>
>>
>> Brett
>>
>>
>>
>> Brett Walker <brett.walker@geometryit.com>
>>
>> Software Developer / Analyst
>>
>> Geometry Pty Ltd
>>
>>
>>
>> Telephone            03 6223 1999
>>
>> Mobile                   0458 498 386
>>
>> Fax                          03 6223 1988
>>
>> Web                        www.geometryit.com
>>
>> Address                                 31 Salamanca Square, Battery Point,
>> TAS 7004, Australia
>>
>>
>
> --
> Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-jdbc



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Curious behaviour with Execute Batch and Prepared Statements
@ 2012-06-25 04:34  Craig Ringer <ringerc@ringerc.id.au>
  parent: Brett Walker <brett.walker@geometryit.com>
  1 sibling, 1 reply; 7+ messages in thread

From: Craig Ringer @ 2012-06-25 04:34 UTC (permalink / raw)
  To: Brett Walker <brett.walker@geometryit.com>; +Cc: pgsql-jdbc

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-stateme...
>

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

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Curious behaviour with Execute Batch and Prepared Statements
@ 2012-06-25 10:23  Brett Walker <brett.walker@geometryit.com>
  parent: Craig Ringer <ringerc@ringerc.id.au>
  0 siblings, 0 replies; 7+ messages in thread

From: Brett Walker @ 2012-06-25 10:23 UTC (permalink / raw)
  To: 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@ringerc.id.au]
Sent: Monday, 25 June 2012 2:34 PM
To: Brett Walker
Cc: pgsql-jdbc@postgresql.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-stateme...

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



^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2012-06-25 10:23 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-06-24 05:58 Curious behaviour with Execute Batch and Prepared Statements Brett Walker <brett.walker@geometryit.com>
2012-06-24 11:09 ` Dave Cramer <pg@fastcrypt.com>
2012-06-24 11:26   ` Brett Walker <brett.walker@geometryit.com>
2012-06-24 13:22     ` Dave Cramer <pg@fastcrypt.com>
2012-06-24 13:44       ` Brett Walker <brett.walker@geometryit.com>
2012-06-25 04:34 ` Craig Ringer <ringerc@ringerc.id.au>
2012-06-25 10:23   ` Brett Walker <brett.walker@geometryit.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox