Re: PL/Perl Does not Like vstrings

From: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PL/Perl Does not Like vstrings
Date: 2012-01-05 17:28:47
Message-ID: 6E866333-1A67-4639-B744-9C423DD8EAB0@justatheory.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Jan 5, 2012, at 7:34 AM, Tom Lane wrote:

>> That still crashes, but doesn't if we use sv_mortalcopy unconditionally.
>
> Unconditional sv_mortalcopy sounds like the thing to do then, but a
> comment would help. And if this isn't a Perl bug, I would like to
> know what is.

Question: Is this an issue anywhere else in PL/Perl, or just elog()? What about SPI parameters or return values?

david=# DO LANGUAGE PLPERL $$
david$# my $plan = spi_prepare('SELECT $1', 'TEXT');
david$# spi_query_prepared($plan, $^V);
david$# spi_freeplan($plan);
david$# return;
david$# $$;
ERROR: cannot convert Perl hash to non-composite type text at line 3.
CONTEXT: PL/Perl anonymous code block

No segfault, at least, though that’s a rather bizarre error message. AFAIK, $^V isn’t a hash. This works, though:

DO LANGUAGE PLPERL $$
my $plan = spi_prepare('SELECT $1', 'TEXT');
spi_query_prepared($plan, v1);
spi_freeplan($plan);
return;
$$;
DO

Best,

David

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-01-05 17:41:28 Re: PL/Perl Does not Like vstrings
Previous Message David E. Wheeler 2012-01-05 17:17:42 Re: PL/Perl Does not Like vstrings