Skip to content
This repository

array parser does not handle commas in text properly #99

Closed
jzimmek opened this Issue · 2 comments

2 participants

Jan Zimmek Philipp Borgers
Jan Zimmek

It seems that something is wrong in the parser for text arrays. A text element containing a "," character will be interpreted as new element. i have not digged deeply in the node-postgres source, but found "test/integration/client/array-test.js"

this will break as soon as i add a "," in the array element:

change from:
client.query('INSERT INTO why(names, numbors) VALUES(\'{"aaron", "brian","a b c" }\', \'{1, 2, 3}\')').on('error', console.log);

change to:
client.query('INSERT INTO why(names, numbors) VALUES(\'{"aaron, INCLUDING COMMA", "brian","a b c" }\', \'{1, 2, 3}\')').on('error', console.log);

is this a known issue and maybe there is already a patch / fix ?

regards
jan

Philipp Borgers
Collaborator

I think this is more or less a know issue. Once someone started implementing a simple regex for the complex array parsing problem. He missed some cases and now people try to improve it little by little.

If you want to provide us with a proper test case you should take a look at https://github.com/brianc/node-postgres/blob/master/test/unit/client/query-tests.js

There is also the binary query mode that should support arrays a bit better but maybe causes perfomance issues.

Regards
Philipp

Jan Zimmek

fixed by #100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.