From: Andrew Dunstan Date: Fri, 25 Jan 2008 15:28:35 +0000 (+0000) Subject: Fix example of de-escaping bytea argument, per Florian Weimer. Also fix example X-Git-Tag: REL8_3_0~33 X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=a794b99a318251d939e5b687f8d7efa63d986108;p=postgresql.git Fix example of de-escaping bytea argument, per Florian Weimer. Also fix example of escaping bytea return value. Both cases did not handle backslash values properly. --- diff --git a/doc/src/sgml/plperl.sgml b/doc/src/sgml/plperl.sgml index 826088c9c5f..11040c5700c 100644 --- a/doc/src/sgml/plperl.sgml +++ b/doc/src/sgml/plperl.sgml @@ -1,4 +1,4 @@ - + PL/Perl - Perl Procedural Language @@ -150,7 +150,7 @@ $$ LANGUAGE plperl; my $arg = shift; - $arg =~ s!\\(\d{3})!chr(oct($1))!ge; + $arg =~ s!\\(?:\\|(\d{3}))!$1 ? chr(oct($1)) : "\\"!ge; @@ -161,7 +161,7 @@ $$ LANGUAGE plperl; is how to escape binary data for a return value of type bytea: - $retval =~ s!([^ -~])!sprintf("\\%03o",ord($1))!ge; + $retval =~ s!(\\|[^ -~])!sprintf("\\%03o",ord($1))!ge; return $retval;