Skip site navigation (1) Skip section navigation (2)

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

From: Ned Wolpert <ned(dot)wolpert(at)knowledgenet(dot)com>
To: Dave(at)micro-automation(dot)net, PostgreSQL-JDBC <pgsql-jdbc(at)postgresql(dot)org>
Cc: "'Barry Lind'" <barry(at)xythos(dot)com>
Subject: Re: Update for bug in org.postgresql.Connection method
Date: 2001-12-10 22:05:25
Message-ID: 1008021925.1617.5.camel@osti.knowledgenet.corp (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc

  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 

Ned Wolpert <ned(dot)wolpert(at)knowledgenet(dot)com>

D08C2F45:  28E7 56CB 58AC C622 5A51  3C42 8B2B 2739 D08C 2F45 


pgsql-jdbc by date

Next:From: Ned WolpertDate: 2001-12-10 22:33:19
Subject: Re: Bug with caching SQLTypes in Connection:getSQLType(oid)
Previous:From: Barry LindDate: 2001-12-10 20:35:42
Subject: Re: Insert/Update that doesn't

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group