Re: Update for bug in org.postgresql.Connection method

From: Antonio Fiol Bonnín <fiol(at)w3ping(dot)com>
To: Ned Wolpert <ned(dot)wolpert(at)knowledgenet(dot)com>
Cc: Dave(at)micro-automation(dot)net, PostgreSQL-JDBC <pgsql-jdbc(at)postgresql(dot)org>, "'Barry Lind'" <barry(at)xythos(dot)com>
Subject: Re: Update for bug in org.postgresql.Connection method
Date: 2001-12-11 07:44:14
Message-ID: 3C15B94E.9040608@w3ping.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Even simpler test. Just populate a simple table, and use the classical
PostgreSQL testing example by calling resultset.getObject() instead of
resultset.getString() or resultset.getInt().

When you call getObject(), it needs to know the type so it executes
getSQLType() internally.

Antonio

Ned Wolpert wrote:

>Dave-
>
> Yeah, sorry about that. I was having communication problems on
>Friday. ;-)
>
> Basically, the test case is calling getSQLType() in a valid
>connection, and give it a valid oid, like 23 or 1043 or 701. (Least in
>my database) (Or call it indirectly by using the DatabaseMetaData
>class, and invoke getColumns()) Watching the database logfiles with
>debug on,you can see the following many times:
>
>Dec 10 12:11:23 osti logger: DEBUG: query: select typname from pg_type
>where oid = 701
>
>This query originates in the getSQLType(int) method off of the
>Connection class. Its is called since the method checks the wrong
>hashtable for the results to be cached. My fix I outlined below solves
>this. In my server, the fix works fine. Of course, I expect other
>people to check it out themselves.
>
>A good testcase is simply calling getSQLType(int) using valid oid over
>and over again, watching the database logs. It should only log once,
>since the JDBC driver is susposed to cache it. I'll write a quick
>little dity to test this and forward it to the group as well.
>
>On Mon, 2001-12-10 at 13:14, Dave Cramer wrote:
>
>>Ned,
>>
>>There was quite a bit of "iffy" language in your other posts. Can we get
>>a test case for it, to make sure we aren't introducing new bugs?
>>
>>Dave
>>
>>-----Original Message-----
>>From: pgsql-jdbc-owner(at)postgresql(dot)org
>>[mailto:pgsql-jdbc-owner(at)postgresql(dot)org] On Behalf Of Ned Wolpert
>>Sent: Monday, December 10, 2001 2:49 PM
>>To: PostgreSQL-JDBC
>>Subject: [JDBC] Update for bug in org.postgresql.Connection method
>>getSQLType(int)
>>
>>
>>Folks-
>>
>> Seeing that people are looking to do a beta4 or rc1 release this week,
>>I'd really like to see if we can fix this bug in the jdbc driver. Its a
>>matter of replacing the line 1106 to use the sqlTypeCache rather than
>>the typeOidCache, so it reads like this:
>> Integer sqlType = (Integer)sqlTypeCache.get(new Integer(oid));
>>(sqlTypeCache maps oid -> SQLType based on the comments in the code)
>>
>> What has to happen for this change to be accepted? This fix really
>>helps out the Castor project since the method getSQLType(int) gets
>>called alot via the DatabaseMetaDate class.
>>
>>Thanks.
>>
>>
>>--
>>
>>Virtually,
>>Ned Wolpert <ned(dot)wolpert(at)knowledgenet(dot)com>
>>
>>D08C2F45: 28E7 56CB 58AC C622 5A51 3C42 8B2B 2739 D08C 2F45
>>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Nick Fankhauser 2001-12-11 19:56:49 Re: Insert/Update that doesn't
Previous Message Barry Lind 2001-12-11 05:18:27 Re: JDBC 3.0 / JDK 1.4 build issues