plperl: Documentation on BYTEA decoding is wrong

Поиск
Список
Период
Сортировка
От Florian Weimer
Тема plperl: Documentation on BYTEA decoding is wrong
Дата
Msg-id 82wspy5gce.fsf@mid.bfk.de
обсуждение исходный текст
Ответы Re: plperl: Documentation on BYTEA decoding is wrong  (Andrew Dunstan <andrew@dunslane.net>)
Список pgsql-hackers
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.)

--
Florian Weimer                <fweimer@bfk.de>
BFK edv-consulting GmbH       http://www.bfk.de/
Kriegsstraße 100              tel: +49-721-96201-1
D-76133 Karlsruhe             fax: +49-721-96201-99


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

Предыдущее
От: Robert Treat
Дата:
Сообщение: Re: autonomous transactions
Следующее
От: Simon Riggs
Дата:
Сообщение: Truncate Triggers