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

Поиск
Список
Период
Сортировка
От Ned Wolpert
Тема Re: Update for bug in org.postgresql.Connection method
Дата
Msg-id 1008021925.1617.5.camel@osti.knowledgenet.corp
обсуждение исходный текст
Список pgsql-jdbc
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@postgresql.org
> [mailto:pgsql-jdbc-owner@postgresql.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.wolpert@knowledgenet.com>
>
> D08C2F45:  28E7 56CB 58AC C622 5A51  3C42 8B2B 2739 D08C 2F45
--

Virtually,
Ned Wolpert <ned.wolpert@knowledgenet.com>

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

Вложения

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Barry Lind
Дата:
Сообщение: Re: Insert/Update that doesn't
Следующее
От: Ned Wolpert
Дата:
Сообщение: Re: Bug with caching SQLTypes in Connection:getSQLType(oid)