alaisi / postgres-async-driver

Asynchronous PostgreSQL Java driver
Apache License 2.0
287 stars 38 forks source link

Incorrect parsing of varchar arrays #18

Closed ljodal closed 8 years ago

ljodal commented 8 years ago

Hey,

I'm having some problems with incorrect parsing of varchar arrays from Postgres 9.5. I have an array column with two values: ["hkKIQhmzKP", "NoxgUELtsC"]. This is returned by the database as {hkKIQhmzKP,NoxgUELtsC} and is incorrectly parsed by the driver into this array: ["hkKIQhmzKP",null,"UELtsC"].

From playing around in the pg console, it appears that Postgres is selectively quoting strings when required. So if a String contains a comma or is "NULL" it will be quoted. This means that in general strings will not be quoted. From looking at the code, it appears that at the moment, this driver will parse any string as null if it's unquoted and starts with an upper case N.

I'll try to put together a pull request with a fix.