agora inbox for pljava-dev@postgresql.org
help / color / mirror / Atom feedSubject: [Pljava-dev] retaining prepared statements across stored procedure calls
Date: Sat, 16 Apr 2011 07:27:27 +0200
Message-ID: <4DA928BF.7080100@tada.se> (raw)
In-Reply-To: <op.vtz51bbduxs6vk@localhost>
References: <DUB103-w4058D109F7165ACBB748BCBEA80@phx.gbl>
<4DA36735.4080402@tada.se>
<DUB103-w619D7BE5CD6732004A3A11BEA80@phx.gbl>
<op.vtz51bbduxs6vk@localhost>
Yes, there are reasons. One reason is that calls can come from functions with different SecurityManagers. Keeping a
state between those calls could introduce security leaks and IIRC, the statement is attached to an SPI context. Another
reason is memory preservation. There is no natural way of doing a proper clean up unless you do it when the call ends.
There might be other reasons as well. It's been a while since I looked at the actual code.
- thomas
On 2011-04-16 01:25, Johann 'Myrkraverk' Oskarsson wrote:
>
>>> When
>>> I call callProc in psql, I get a warning about closing 1
>>> forgotten statement. Does that mean I cannot have prepared
>>> statements lingering around after each store procedure
>>> invocation?
>>>
>> Yes it does.
>> - thomas
>
> Is there a good reason for this?
>
> Is there something wrong with initializing prepared statements within a static initializer?
>
> PreparedStatment prep;
>
> static {
> //...
> prep = connection.prepareStatement( "select 1;" );
> //...
> }
>
> public static useStatement() {
> //...
> prep.executeQuery();
> //...
> }
>
view thread (4+ messages)
Message-ID: <4DA928BF.7080100@tada.se>
Permalink: ../4DA928BF.7080100@tada.se/
Also on: postgresql.org/message-id/4DA928BF.7080100@tada.se
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pljava-dev@postgresql.org
Subject: Re: [Pljava-dev] retaining prepared statements across stored procedure calls
In-Reply-To: <4DA928BF.7080100@tada.se>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox