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

From Jeff Janes
Subject Re: Perl function leading to out of memory error
Date
Msg-id CAMkU=1w1hHLOLHkNcDUN12QU3nUY9tQ6x6=LTAZfA-8623RzUw@mail.gmail.com
Whole thread Raw
In response to Re: Perl function leading to out of memory error  (Christian Schröder <cs@deriva.de>)
Responses Re: Perl function leading to out of memory error  (Christian Schröder <cs@deriva.de>)
List pgsql-general
On Wed, Feb 20, 2013 at 9:31 AM, Christian Schr=F6der <cs@deriva.de> wrote:

> after some investigation it seems that the error has to do with a domain
> type that we have defined in our database. We have defined the following
> helper functions:
>
...
>
> 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.

>
> Now we can create our test case. Create the following table:
>
> CREATE TABLE foo (isin char(12) NOT NULL);
>
> And this function:
>
> CREATE OR REPLACE FUNCTION foo(isin char(12)) RETURNS void AS $$
> my ($isin) =3D @_;
>
> my $stmt =3D 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?

Cheers,

Jeff

pgsql-general by date:

Previous
From: Sergey Konoplev
Date:
Subject: Re: PgBouncer with many databases
Next
From: Kirk Wythers
Date:
Subject: Re: PostgreSQL took over my login