The driver will drop whitespace when parsing elements from an array of VARCHAR, if the server chooses to format the array without using quotes to enclose the elements.
corpus=> select version();
version
------------------------------------------------------------------------------
PostgreSQL 9.6.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.9.3, 64-bit
corpus=> select middle_names, aliases from author where ai2_id = '2869674';
middle_names | aliases
--------------+---------------------
{P T} | {"Jeremy P T Ward"}
In the above case, both columns contain a single element, but the server uses quotes to enclose the elements only for one of the columns. Consequently, the driver extracts the middle_names column as ["PT"] instead of ["P T"]. When the server uses binary encoding, the correct value is extracted.
The following unit test illustrates the failure. Reproduced using mocks since it's hard to control how the server decides to encode the result.
Using postgresql-42.2.4
The driver will drop whitespace when parsing elements from an array of VARCHAR, if the server chooses to format the array without using quotes to enclose the elements.
In the above case, both columns contain a single element, but the server uses quotes to enclose the elements only for one of the columns. Consequently, the driver extracts the
middle_names
column as["PT"]
instead of["P T"]
. When the server uses binary encoding, the correct value is extracted.The following unit test illustrates the failure. Reproduced using mocks since it's hard to control how the server decides to encode the result.