Re: BUG #17142: COPY ignores client_encoding for octal digit characters

From: vilarion(at)illarion(dot)org
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17142: COPY ignores client_encoding for octal digit characters
Date: 2021-08-12 08:01:56
Message-ID: 3cdb97c9-9c7b-db35-c096-1c18cb3bf3c7@tu-dortmund.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


On 12.08.2021 09:40, Heikki Linnakangas wrote:
> On 12/08/2021 00:24, PG Bug reporting form wrote:
>> Characters in octal digits should be possible as per
>> https://www.postgresql.org/docs/13/sql-copy.html
>> When using characters directly (char buffer[] = "\304\366\337") the
>> expected
>> output is displayed.
>>
>> My apologies if I misunderstood something.
>
> The code is pretty clear that the \123 and \x12 escapes are evaluated
> after encoding conversion. That means, the escapes are interpreted
> using the database encoding, regardless of client encoding. The
> documentation doesn't say anything about that, though. We should fix
> the docs. How does the attached patch look?
>
> You could get weird results if you use the escapes for some bytes in a
> multi-byte character. Mostly you'd get invalid byte sequence errors,
> but I think with the right combination of the client and database
> encodings, it could get more strange. I think the wording in the
> attached docs patch is enough to cover that, though.
>
> - Heikki

Thanks for clarifying! This patch to the docs will allow me to file a
bug report against the library I am using (pqxx).

Andreas

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Heikki Linnakangas 2021-08-12 08:38:42 Re: SEGFAULT on a concurrent UPDATE of mix of local and foreign partitions
Previous Message Heikki Linnakangas 2021-08-12 07:40:35 Re: BUG #17142: COPY ignores client_encoding for octal digit characters