Re: Perl function leading to out of memory error - Mailing list pgsql-general

From Christian Schröder
Subject Re: Perl function leading to out of memory error
Date
Msg-id 51278197.6060300@deriva.de
Whole thread Raw
In response to Re: Perl function leading to out of memory error  (Jeff Janes <jeff.janes@gmail.com>)
List pgsql-general
On 21.02.2013 01:02, Jeff Janes wrote:
>> CREATE DOMAIN isin AS char(12) CHECK (isin_ok(value));
> Could you give some example values that meet this criteria?  Trying to
> reverse engineer your helper functions is no fun.
A valid example is "DE0007100000". The same with another check digit is
of course invalid (e.g. "DE0007100001").
>> CREATE OR REPLACE FUNCTION foo(isin char(12)) RETURNS void AS $$
>> my ($isin) = @_;
>>
>> my $stmt = spi_prepare('
>>      INSERT INTO foo (isin)
>>      VALUES ($1)', 'isin');
>> spi_exec_prepared($stmt, $isin);
>> spi_freeplan($stmt);
>> $$ LANGUAGE plperl VOLATILE STRICT;
> That should be easy enough to re-write as plpgsql.  If you do, does it
> still leak?
I have no idea how to create a prepared statement in plpgsql. I have
tested the following function:

CREATE OR REPLACE FUNCTION foo(isin char(12)) RETURNS void AS $$
BEGIN    INSERT INTO foo (isin) VALUES (isin);
END;
$$ LANGUAGE plpgsql VOLATILE STRICT;

This works without any problem.

Regards,
Christian

--
Deriva GmbH                         Tel.: +49 551 489500-42
Financial IT and Consulting         Fax:  +49 551 489500-91
Hans-Böckler-Straße 2                  http://www.deriva.de
D-37079 Göttingen

Amtsgericht Göttingen | HRB 3240
Geschäftsführer: Dirk Baule, Christian Schröder
Deriva CA Certificate: http://www.deriva.de/deriva-ca.cer




pgsql-general by date:

Previous
From: Clodoaldo Neto
Date:
Subject: Access a window's frame_end row from a window function
Next
From: "James B. Byrne"
Date:
Subject: Re: Need help extripating plpgsql