Re: plperl: Documentation on BYTEA decoding is wrong

Поиск
Список
Период
Сортировка
От Robert Treat
Тема Re: plperl: Documentation on BYTEA decoding is wrong
Дата
Msg-id 200801261207.26308.xzilla@users.sourceforge.net
обсуждение исходный текст
Ответ на Re: plperl: Documentation on BYTEA decoding is wrong  (Andrew Dunstan <andrew@dunslane.net>)
Ответы Re: plperl: Documentation on BYTEA decoding is wrong  (Florian Weimer <fweimer@bfk.de>)
Список pgsql-hackers
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:
> >
> >     my $arg = shift;
> >     $arg =~ s!\\(?:\\|(\d{3}))!$1 ? chr(oct($1)) : "\\"!ge;
> >
> > You need to do this in one go because pre-escaped backslashes like
> > like '\\101' cause problems otherwise.
> >
> > (All ''-delimited strings in this posting use strict SQL syntax,
> > i.e. no escaped backslashes.)
>
> I think you're right, although that's rather ugly ;-) I'll commit this
> change for now, but if anyone comes up with a simpler recipe I'll be happy.
>

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. 

-- 
Robert Treat
Build A Brighter LAMP :: Linux Apache {middleware} PostgreSQL


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: Truncate Triggers
Следующее
От: Ivan Voras
Дата:
Сообщение: Simple row serialization?