diff options
author | Andrew Dunstan <andrew@dunslane.net> | 2008-01-25 15:28:35 +0000 |
---|---|---|
committer | Andrew Dunstan <andrew@dunslane.net> | 2008-01-25 15:28:35 +0000 |
commit | a794b99a318251d939e5b687f8d7efa63d986108 (patch) | |
tree | aa54304c5aea99a2235301fbf84c6d246b83d814 | |
parent | 353a1cca9f9bc1aea895627087e77807a83915e8 (diff) | |
download | postgresql-a794b99a318251d939e5b687f8d7efa63d986108.tar.gz postgresql-a794b99a318251d939e5b687f8d7efa63d986108.zip |
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.
-rw-r--r-- | doc/src/sgml/plperl.sgml | 6 |
1 files changed, 3 insertions, 3 deletions
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 @@ -<!-- $PostgreSQL: pgsql/doc/src/sgml/plperl.sgml,v 2.66 2007/05/04 14:55:32 adunstan Exp $ --> +<!-- $PostgreSQL: pgsql/doc/src/sgml/plperl.sgml,v 2.67 2008/01/25 15:28:35 adunstan Exp $ --> <chapter id="plperl"> <title>PL/Perl - Perl Procedural Language</title> @@ -150,7 +150,7 @@ $$ LANGUAGE plperl; <programlisting> my $arg = shift; - $arg =~ s!\\(\d{3})!chr(oct($1))!ge; + $arg =~ s!\\(?:\\|(\d{3}))!$1 ? chr(oct($1)) : "\\"!ge; </programlisting> </para> @@ -161,7 +161,7 @@ $$ LANGUAGE plperl; is how to escape binary data for a return value of type <type>bytea</>: <programlisting> - $retval =~ s!([^ -~])!sprintf("\\%03o",ord($1))!ge; + $retval =~ s!(\\|[^ -~])!sprintf("\\%03o",ord($1))!ge; return $retval; </programlisting> |