Skip to content

Commit 5c6fa5e

Browse files
committed
This patch, when applied in src/pl will unbreak plperl in
7.0.2 release. Sorry, if that's fixed ages ago - I don't track development versions of PostgreSQL. Patch is just a little bit tested (some valid functions created and successfully run as well as some erroneous ones created and emitted proper error messages when used). My platform is FreeBSD 5.0-CURRENT (with perl 5.6.0 provided in the base system). Alex Kapranoff
1 parent 879639b commit 5c6fa5e

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

src/pl/Makefile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Copyright (c) 1994, Regents of the University of California
66
#
7-
# $Header: /cvsroot/pgsql/src/pl/Makefile,v 1.12 2000/08/31 16:12:09 petere Exp $
7+
# $Header: /cvsroot/pgsql/src/pl/Makefile,v 1.13 2000/09/12 04:28:30 momjian Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -18,10 +18,9 @@ ifeq ($(USE_TCL), true)
1818
DIRS += tcl
1919
endif
2020

21-
# Disabled because it doesn't work
22-
#ifeq ($(with_perl), yes)
23-
#DIRS += plperl
24-
#endif
21+
ifeq ($(with_perl), yes)
22+
DIRS += plperl
23+
endif
2524

2625
all install installdirs uninstall depend distprep:
2726
@for dir in $(DIRS); do $(MAKE) -C $$dir $@ || exit; done

src/pl/plperl/plperl.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
* ENHANCEMENTS, OR MODIFICATIONS.
3434
*
3535
* IDENTIFICATION
36-
* $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.12 2000/07/05 23:11:55 tgl Exp $
36+
* $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.13 2000/09/12 04:28:30 momjian Exp $
3737
*
3838
**********************************************************************/
3939

@@ -324,13 +324,13 @@ plperl_create_sub(char * s)
324324
count = perl_call_pv("mksafefunc", G_SCALAR | G_EVAL | G_KEEPERR);
325325
SPAGAIN;
326326

327-
if (SvTRUE(GvSV(errgv)))
327+
if (SvTRUE(ERRSV))
328328
{
329329
POPs;
330330
PUTBACK;
331331
FREETMPS;
332332
LEAVE;
333-
elog(ERROR, "creation of function failed : %s", SvPV(GvSV(errgv), na));
333+
elog(ERROR, "creation of function failed : %s", SvPV_nolen(ERRSV));
334334
}
335335

336336
if (count != 1) {
@@ -449,13 +449,13 @@ plperl_call_perl_func(plperl_proc_desc * desc, FunctionCallInfo fcinfo)
449449
elog(ERROR, "plperl : didn't get a return item from function");
450450
}
451451

452-
if (SvTRUE(GvSV(errgv)))
452+
if (SvTRUE(ERRSV))
453453
{
454454
POPs;
455455
PUTBACK;
456456
FREETMPS;
457457
LEAVE;
458-
elog(ERROR, "plperl : error from function : %s", SvPV(GvSV(errgv), na));
458+
elog(ERROR, "plperl : error from function : %s", SvPV_nolen(ERRSV));
459459
}
460460

461461
retval = newSVsv(POPs);
@@ -661,7 +661,7 @@ plperl_func_handler(PG_FUNCTION_ARGS)
661661
else
662662
{
663663
retval = FunctionCall3(&prodesc->result_in_func,
664-
PointerGetDatum(SvPV(perlret, na)),
664+
PointerGetDatum(SvPV_nolen(perlret)),
665665
ObjectIdGetDatum(prodesc->result_in_elem),
666666
Int32GetDatum(prodesc->result_in_len));
667667
}
@@ -2184,6 +2184,6 @@ plperl_build_tuple_argument(HeapTuple tuple, TupleDesc tupdesc)
21842184
sv_catpvf(output, "'%s' => undef,", attname);
21852185
}
21862186
sv_catpv(output, "}");
2187-
output = perl_eval_pv(SvPV(output, na), TRUE);
2187+
output = perl_eval_pv(SvPV_nolen(output), TRUE);
21882188
return output;
21892189
}

0 commit comments

Comments
 (0)