Re: pgsql: Fix breakage from earlier plperl fix.

Andrew Dunstan <andrew@dunslane.net>

From: Andrew Dunstan <andrew@dunslane.net>
To: Alex Hunsaker <badalex@gmail.com>
Cc: pgsql-committers@postgresql.org, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2012-01-05T23:59:53Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Fix breakage from earlier plperl fix.


On 01/05/2012 06:31 PM, Alex Hunsaker wrote:
> On Thu, Jan 5, 2012 at 16:02, Andrew Dunstan<andrew@dunslane.net>  wrote:
>> Fix breakage from earlier plperl fix.
>>
>> Apparently the perl garbage collector was a bit too eager, so here
>> we control when the new SV is garbage collected.
> I know im a little late to the party...
>
> I can't help but think this seems a bit inefficient for the common
> case. Would it be worth only copying the sv when its a glob or
> readonly? Something like the below? I tested a few more svtypes that
> were easy to make (code, regexp) and everything seems peachy.


I'm not so concerned about elog() use, and anyway there the most common 
case surely will be passing a readonly string.

I'm more concerned about all the other places we call sv2cstr().

"SvTYPE(sv) == SVt_PVGV" is what I was looking for in vain in the perl docs.

So, yes, we should probably adjust this one more time, but ideally we 
need a better test than just SvREADONLY(). If you want to follow up your 
investigation of exactly when we need a copied SV and see how much you 
can narrow it down that would be great.

cheers

andrew