Re: [HACKERS] plperl: Documentation on BYTEA decoding is wrong

2008-12-15 Thread Robert Treat
On Monday 28 January 2008 05:37:03 Florian Weimer wrote: > * Robert Treat: > > Note we've been using Theo's plperl bytea patch on one of our > > production servers for some time; if anyone wants access to that > > lmk. > > I'm interested. Could you post a pointer to this code, please? I had to do

Re: [HACKERS] plperl: Documentation on BYTEA decoding is wrong

2008-01-28 Thread Florian Weimer
* Robert Treat: > Note we've been using Theo's plperl bytea patch on one of our > production servers for some time; if anyone wants access to that > lmk. I'm interested. Could you post a pointer to this code, please? -- Florian Weimer<[EMAIL PROTECTED]> BFK edv-consulting GmbH

Re: [HACKERS] plperl: Documentation on BYTEA decoding is wrong

2008-01-26 Thread Robert Treat
On Friday 25 January 2008 10:11, Andrew Dunstan wrote: > Florian Weimer wrote: > > This doesn't work because '\' is turned into '\\' by PostgreSQL, and > > not '\134': > > > > my $arg = shift; > > $arg =~ s!\\(\d{3})!chr(oct($1))!ge; > > > > Something like this might be better: > > > >

Re: [HACKERS] plperl: Documentation on BYTEA decoding is wrong

2008-01-25 Thread Andrew Dunstan
Florian Weimer wrote: This doesn't work because '\' is turned into '\\' by PostgreSQL, and not '\134': my $arg = shift; $arg =~ s!\\(\d{3})!chr(oct($1))!ge; Something like this might be better: my $arg = shift; $arg =~ s!\\(?:\\|(\d{3}))!$1 ? chr(oct($1)) : "\\"!ge; You need

[HACKERS] plperl: Documentation on BYTEA decoding is wrong

2008-01-25 Thread Florian Weimer
This doesn't work because '\' is turned into '\\' by PostgreSQL, and not '\134': my $arg = shift; $arg =~ s!\\(\d{3})!chr(oct($1))!ge; Something like this might be better: my $arg = shift; $arg =~ s!\\(?:\\|(\d{3}))!$1 ? chr(oct($1)) : "\\"!ge; You need to do this in one go beca