Alex Hunsaker <badalex(at)gmail(dot)com> writes:
> If you do:
> # DO $do$ 1; $do$ LANGUAGE plperlu;
> # DO $do$ 1; $do$ LANGUAGE plperl;
> You get a segfault as we try to SvREFCNT_dec(...); for the wrong
> interpreter. To fix push down the restore_context() so that we do the
> above on the correct perl interpreter.
Hmm. I don't see a segfault on my machine, but I agree that this looks
bogus. I changed it to this order instead:
if (desc.reference)
SvREFCNT_dec(desc.reference);
current_call_data = save_call_data;
restore_context(oldcontext);
so as to keep the "state restore" operations together.
regards, tom lane