Re: [Fwd: Re: dblink patches for comment] - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [Fwd: Re: dblink patches for comment]
Date
Msg-id 20219.1244561721@sss.pgh.pa.us
Whole thread Raw
In response to Re: [Fwd: Re: dblink patches for comment]  (Joe Conway <mail@joeconway.com>)
Responses Re: [Fwd: Re: dblink patches for comment]  (Joe Conway <mail@joeconway.com>)
List pgsql-hackers
Joe Conway <mail@joeconway.com> writes:
> I think the attached is what you had in mind. But I don't know right off 
> how to trigger the failure (and therefore how to test the solution). A 
> naive test with two databases, one LATIN2, the other UTF8 does not 
> produce the error with simple text literals.

I can reproduce an error (and verify the patch corrects it) using this
test case:

select '�x�y'::text as x;

select * from dblink('dbname = u8', $$select '�x�y'::text$$)
as t1 (x text);

(The two non-ASCII characters are octal 340 and 367, if they don't come
through properly in your mail.)  Execute in a LATIN1 database (being sure
client_encoding is also LATIN1), connecting to a database with encoding
UTF8.  With the patch, both commands give the same results; without,
I get

ERROR:  invalid byte sequence for encoding "UTF8": 0xe078f7
HINT:  This error can also happen if the byte sequence does not match the encoding expected by the server, which is
controlledby "client_encoding".
 
CONTEXT:  Error occurred on dblink connection named "unnamed": could not execute query.

Please get this committed soon, we have other stuff to get done
(like a pgindent run).
        regards, tom lane


pgsql-hackers by date:

Previous
From: gj
Date:
Subject: Re: Patch for automating partitions in PostgreSQL 8.4 Beta 2
Next
From: Simon Riggs
Date:
Subject: page is uninitialized --- fixing