Re: PQescapeBytea is not multibyte aware - Mailing list pgsql-hackers

From Joe Conway
Subject Re: PQescapeBytea is not multibyte aware
Date
Msg-id 3CADEDFC.508@joeconway.com
Whole thread Raw
In response to PQescapeBytea is not multibyte aware  (Tatsuo Ishii <t-ishii@sra.co.jp>)
Responses Re: PQescapeBytea is not multibyte aware  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:
> 
> OTOH, I was surprised to read your message because I had assumed the
> damage was being done much further upstream, viz during collection of
> the query string by pq_getstr().  Do we need to think twice about that
> processing, as well?
> 

I just looked in pq_getstr() I see:

#ifdef MULTIBYTE
p = (char *) pg_client_to_server((unsigned char *) s->data, s->len);
if (p != s->data)          /* actual conversion has been done? */


and in pg_client_to_server I see:

if (ClientEncoding->encoding == DatabaseEncoding->encoding)return s;


So I'm guessing that in Tatsuo's case, both client and database encoding 
are the same, and therefore the string was passed as-is downstream. I 
think you're correct that in a client/database encoding mismatch 
scenario, there would be bigger problems. Thoughts on this?

Joe





pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: PQescapeBytea is not multibyte aware
Next
From: Tom Lane
Date:
Subject: Re: PQescapeBytea is not multibyte aware