Re: DBD::Pg BYTEA Character Escaping

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: DBD::Pg BYTEA Character Escaping
Дата
Msg-id 2119.1006062406@sss.pgh.pa.us
обсуждение исходный текст
Ответ на DBD::Pg BYTEA Character Escaping  (David Wheeler <david@wheeler.net>)
Ответы Re: DBD::Pg BYTEA Character Escaping  (David Wheeler <david@wheeler.net>)
7.1.2: Backend message type 0x44 when selecting from a table  (Lincoln Yeoh <lyeoh@pop.jaring.my>)
Список pgsql-general
David Wheeler <david@wheeler.net> writes:
> If that's true, then any solution escaping non-printable characters is
> overkill, and therefore only the three characters need to be escaped.

Check ...

> Could be changed to:

>   s/\0/\\000/g if $data_type == DBI::SQL_BINARY ||
>                   $data_type == DBI::SQL_VARBINARY ||
>                   $data_type == DBI::SQL_LONGVARBINARY;

Offhand I don't think you even need the check on the datatype; wouldn't
it be faster and safer to do the substitution unconditionally?  I can't
see that there are any cases that work without this substitution and
fail with it.

            regards, tom lane

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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: DBD::Pg BYTEA Character Escaping
Следующее
От: Alex Pilosov
Дата:
Сообщение: Re: DBD::Pg BYTEA Character Escaping