Re: Perl function leading to out of memory error

From: Christian Schröder <cs(at)deriva(dot)de>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Perl function leading to out of memory error
Date: 2013-02-22 14:32:55
Message-ID: 51278197.6060300@deriva.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message James B. Byrne 2013-02-22 15:25:47 Re: Need help extripating plpgsql
Previous Message Clodoaldo Neto 2013-02-22 14:26:31 Access a window's frame_end row from a window function