Re: Memory leaks using refcursors - Mailing list pgsql-jdbc

From Guillaume Smet
Subject Re: Memory leaks using refcursors
Date
Msg-id 1d4e0c10701180942i60edff8bt914258ab0e1761ac@mail.gmail.com
Whole thread Raw
In response to Re: Memory leaks using refcursors  ("Guillaume Smet" <guillaume.smet@gmail.com>)
Responses Re: Memory leaks using refcursors
List pgsql-jdbc
Hi again,

In fact, there is still a remaining problem. People who developed this
application sometimes commit the transaction before closing the result
set in their code.
With the current driver, it's not a problem as it didn't close the
cursor at all so the cursor is closed at the end of the transaction
and that's all.

But with this patch, we have the following case:
- begin
- open result set -> open the cursor
- commit -> close the cursor
- close the result set -> try to close the cursor -> exception and
backend in an error state if autocommit is false

They fixed the order of commit/close in their application but IMHO,
it's a bad idea to introduce this sort of regression.

A try/catch is probably not a good idea because it leaves the backend
in an error state if the CLOSE query is executed in a transaction (if
autocommit is false for example).

Any ideas on how we can solve this problem? I can't find any way to
check if a cursor is still alive without throwing an error.

--
Guillaume

pgsql-jdbc by date:

Previous
From: Todd Shoemaker
Date:
Subject: Re: Default numeric scale of zero in JDBC?
Next
From: Oliver Jowett
Date:
Subject: Re: Default numeric scale of zero in JDBC?