Re: [Fwd: Re: dblink patches for comment]

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: "Hackers (PostgreSQL)" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [Fwd: Re: dblink patches for comment]
Date: 2009-06-09 15:35:21
Message-ID: 20219.1244561721@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Joe Conway <mail(at)joeconway(dot)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 'xy'::text as x;

select * from dblink('dbname = u8', $$select 'xy'::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 controlled by "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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Albe Laurenz 2009-06-09 15:57:31 Problem with listen_addresses = '*' on 8.4beta2 on AIX
Previous Message gj 2009-06-09 15:15:49 Re: Patch for automating partitions in PostgreSQL 8.4 Beta 2