Re: DBD::Pg BYTEA Character Escaping

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Wheeler <david@wheeler.net>
Cc: pgsql-general@postgresql.org
Date: 2001-11-18T05:46:46Z
Lists: 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