Patch for an encoding bug in the derive_locale_encoding function


I've found a bug while I was working with the driver. It seems that
when the drive gets the encoding from the local environment it takes
everything, for example:


then it clears until the first dot and uses the rest as encoding:


and this gets an error in the following code because is not a right
encoding string:

<a href="" title=""></a>

There are two problems there:

1. First, you get the error because of the encoding
2. It hangs the connection because Postgres uses ereport instead of
returning -1 so it gets stuck

At first, I thought it was an error in the ifdef clause of the
postgres function but it seems correct although I don't know how to
catch that kind of errors to avoid this kind of behavior in cases like

In this mail, I've attached a patch to solve the bug. Hope it helps :)


Re: Patch for an encoding bug in the derive_locale_encoding func

By Inoue, Hiroshi at 02/13/2018 - 19:25

Hi Mario,

On 2018/02/10 2:02, Mario De Frutos wrote:
I would take care of the patch.

Hiroshi Inoue