Re: implement prepared queries in plperl

From: Dmitry Karasik <dmitry(at)karasik(dot)eu(dot)org>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, "Patches (PostgreSQL)" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: implement prepared queries in plperl
Date: 2006-03-02 07:08:39
Message-ID: 20060302070839.GB58286@tetsuo.karasik.eu.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

> Bruce Momjian wrote:
> >Is this patch going to be applied?
> I am waiting for an update from Dmitry.
> cheers
> andrew

I believe this is some kind of misunderstanding, sorry if from my part,
but I don't think any further updates are necessary.

> >>But why do we have to call spi_freeplan? pltcl, which has prepared
> >>queries, doesn't require this AFAICS. If memory leaks are an issue,
> >>maybe we should bless the object into a class with a DESTROY method that
> >>calls spi_freeplan automatically (not sure to do that in XS but I assume
> >>it's possible).

I remember though that my answer to this question didn't hit the list so it's here again,
in case that was meant by 'the update':

I thought of that, indeed the automatic cleanup would be better from one point
of view, but I thought also about that the existing SPI interface is not
object-oriented, so I've extended it in functional style, and that the
mirroring of C SPI functions into Perl would be less encumbered by glue layers,
and again, implementing such a glue layer on top of new spi_ functions would be
trivial.

I also remember I heard about plans about writing a DBI-style API over SPI, and
thought that such (future/imaginary) layer would be ideal for implementing
queries as objects ( including DESTROY ).

Another thing, automatic destruction of a query would prohibit passing the
query handle outside a perl function where the handle has the scope. True, it
is possible to keep the reference count and the handle from destruction in
$_SHARED{}, if necessary, but when finally the handle has to be released, a
wrapper for spi_freeplan() has to be called anyway.

--
Sincerely,
Dmitry Karasik

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message James_Hughes 2006-03-02 07:50:32 Re: Initdb on Windows 2003
Previous Message Tino Wildenhain 2006-03-02 07:05:11 Re: [SQL] Interval subtracting

Browse pgsql-patches by date

  From Date Subject
Next Message Zeugswetter Andreas DCP SD 2006-03-02 08:53:57 Re: Automatic free space map filling
Previous Message Tino Wildenhain 2006-03-02 07:05:11 Re: [SQL] Interval subtracting