Re: DBD::Pg BYTEA Character Escaping - Mailing list pgsql-general

From Tom Lane
Subject Re: DBD::Pg BYTEA Character Escaping
Date
Msg-id 2119.1006062406@sss.pgh.pa.us
Whole thread Raw
In response to DBD::Pg BYTEA Character Escaping  (David Wheeler <david@wheeler.net>)
Responses Re: DBD::Pg BYTEA Character Escaping
7.1.2: Backend message type 0x44 when selecting from a table
List 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 by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: DBD::Pg BYTEA Character Escaping
Next
From: Alex Pilosov
Date:
Subject: Re: DBD::Pg BYTEA Character Escaping