Re: DBD::Pg BYTEA Character Escaping

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Wheeler <david(at)wheeler(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: DBD::Pg BYTEA Character Escaping
Date: 2001-11-18 05:46:46
Message-ID: 2119.1006062406@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

David Wheeler <david(at)wheeler(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alex Pilosov 2001-11-18 16:40:57 Re: DBD::Pg BYTEA Character Escaping
Previous Message Bruce Momjian 2001-11-18 05:45:17 Re: DBD::Pg BYTEA Character Escaping