Re: Error reporting issue in SimpleParameterList

Lists: pgsql-jdbc
From: <Nathan(dot)Keynes(at)csiro(dot)au>
To: <books(at)ejurka(dot)com>
Cc: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Error reporting issue in SimpleParameterList
Date: 2007-06-21 01:14:51
Message-ID: B998A44C8986644EA8029CFE6396A9246F4C9F@exqld2-bne.nexus.csiro.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc


> Getting the names for the oids is tough from this part of the
> code so I
> don't think we can do that. Also I think this is supposed to
> be a "can't
> happen" error that's more of an assert than a message for an
> end user.
> Do you have an example of how to trigger this condition?

Hi Kris,

I've been trying to put together a minimal example of what we were
doing to trigger it, but unfortunately I haven't been able to reproduce
it outside of the original (too large for a test case) dataset yet. We
did trace it to code that was conceptually something like this:

stmt.executeUpdate("create table TEMP1 ( value1 BIGINT )" );
conn.commit();
PreparedStatement ps = conn.prepareStatement("insert into TEMP1
(value1) values (?)");
ps.setObject( 1, new Integer(123) );
ps.addBatch();
ps.setNull( 1, Types.BIGINT );
ps.addBatch();
ps.executeBatch();
ps.setNull( 1, Types.BIGINT );
ps.addBatch();
ps.setObject( 1, new Integer(234) );
ps.addBatch();
ps.executeBatch();

Basically, batch inserts with a BIGINT column, and mixing setObject()
with Integer values with setNull with explicit BIGINT type. The code
fell over on the second executeBatch() although there was no apparent
distinction between the batches for the column it complained about.
Changing the setObject call to eg
setObject( 1, new Integer(123), Types.BIGINT );
did fix the problem for us - at the time I assumed that the code was
complaining about the mixing of INT4 with INT8 in the batch, but it's
looking like there was more to it than that.

This was using Postgres 8.2.3, JDBC driver 8.2-504.

I don't know if the above is particularly helpful - I'll follow up
if/when I can get a reliable test case to reproduce.

Cheers,
Nathan


From: Kris Jurka <books(at)ejurka(dot)com>
To: Nathan(dot)Keynes(at)csiro(dot)au
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Error reporting issue in SimpleParameterList
Date: 2007-06-23 15:51:40
Message-ID: Pine.BSO.4.64.0706231133020.29808@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

On Thu, 21 Jun 2007, Nathan(dot)Keynes(at)csiro(dot)au wrote:

> I've been trying to put together a minimal example of what we were
> doing to trigger it, but unfortunately I haven't been able to reproduce
> it outside of the original (too large for a test case) dataset yet. We
> did trace it to code that was conceptually something like this:
>

I can't trigger it either. What might help is running your original code
with driver logging turned on. Add ?loglevel=2 to your JDBC URL and it
will log everything the driver is doing behind the scenes. From this
perhaps we can see where the driver is getting confused.

Kris Jurka