The attached patch appears to fix the problem discussed in the "plperl gives error after reconnect" thread in pgsql-bugs:
http://archives.postgresql.org/pgsql-bugs/2005-08/msg00133.php Unfortunately I don't understand *why* it fixes the problem, which means I'm not sure that it's the correct fix. As Tom Lane and I discovered, Perl builds with threading don't appear to have a problem, while Perl builds without threading do. It's not clear to me why "mksafefunc" works in some Perl installations but "::mksafefunc" is required in others, given otherwise identical test conditions. Can anybody explain? If this is indeed the correct fix then it should probably be backpatched to 8.0. -- Michael Fuhr
Index: plperl.c =================================================================== RCS file: /projects/cvsroot/pgsql/src/pl/plperl/plperl.c,v retrieving revision 1.89 diff -c -r1.89 plperl.c *** plperl.c 12 Aug 2005 21:26:32 -0000 1.89 --- plperl.c 20 Aug 2005 18:35:14 -0000 *************** *** 680,686 **** * errors properly. Perhaps it's because there's another level of * eval inside mksafefunc? */ ! count = perl_call_pv((trusted ? "mksafefunc" : "mkunsafefunc"), G_SCALAR | G_EVAL | G_KEEPERR); SPAGAIN; --- 680,686 ---- * errors properly. Perhaps it's because there's another level of * eval inside mksafefunc? */ ! count = perl_call_pv((trusted ? "::mksafefunc" : "::mkunsafefunc"), G_SCALAR | G_EVAL | G_KEEPERR); SPAGAIN;
---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend