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

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 (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-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

pgsql-hackers by date

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

pgsql-patches by date

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

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