Обсуждение: Byte Escape Syntax

Поиск
Список
Период
Сортировка

Byte Escape Syntax

От
Howard Yeh
Дата:
Hi,

Is Postgres's byte escape syntax something that could be set by the client?

I am running into a strange problem when I access postgres try two
different Ruby ORM's. I am guessing that one of them is doing
something funny to the client connections.

Looking at the Ruby C-driver, it's calling PQescapeBytea rather then
PQescapeByteaConn. And tracing PQescapeBytea, sometimes it escapes '\'
as '\\', as describe in the manual, sometimes it doesn't do that
escape. But it always escape the single quote character ' . All the
connections are using UTF-8 encoding.

I wrote my own byte escaping function in Ruby, which does escaping
according to the 8.4 manual, but again it works for some connections,
but not others.

Howard

Re: Byte Escape Syntax

От
Tom Lane
Дата:
Howard Yeh <hayeah@gmail.com> writes:
> Is Postgres's byte escape syntax something that could be set by the client?

Well, indirectly --- it's affected by the standard_conforming_strings
setting.

> I am running into a strange problem when I access postgres try two
> different Ruby ORM's. I am guessing that one of them is doing
> something funny to the client connections.

> Looking at the Ruby C-driver, it's calling PQescapeBytea rather then
> PQescapeByteaConn. And tracing PQescapeBytea, sometimes it escapes '\'
> as '\\', as describe in the manual, sometimes it doesn't do that
> escape. But it always escape the single quote character ' . All the
> connections are using UTF-8 encoding.

It would be a real good idea to fix that driver to use PQescapeByteaConn.
There are no supported releases of Postgres that don't have that
function.

            regards, tom lane

Re: Byte Escape Syntax

От
Howard Yeh
Дата:
On Thu, Apr 15, 2010 at 10:45 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Howard Yeh <hayeah@gmail.com> writes:
>> Is Postgres's byte escape syntax something that could be set by the client?
>
> Well, indirectly --- it's affected by the standard_conforming_strings
> setting.

is this something that could be set at runtime? Does it apply to the
whole database server?

Thanks!

>
>> I am running into a strange problem when I access postgres try two
>> different Ruby ORM's. I am guessing that one of them is doing
>> something funny to the client connections.
>
>> Looking at the Ruby C-driver, it's calling PQescapeBytea rather then
>> PQescapeByteaConn. And tracing PQescapeBytea, sometimes it escapes '\'
>> as '\\', as describe in the manual, sometimes it doesn't do that
>> escape. But it always escape the single quote character ' . All the
>> connections are using UTF-8 encoding.
>
> It would be a real good idea to fix that driver to use PQescapeByteaConn.
> There are no supported releases of Postgres that don't have that
> function.
>
>                        regards, tom lane
>