Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

array parser does not handle commas in text properly #99

Closed
jzimmek opened this issue Feb 17, 2012 · 2 comments
Closed

array parser does not handle commas in text properly #99

jzimmek opened this issue Feb 17, 2012 · 2 comments

Comments

@jzimmek
Copy link
Contributor

jzimmek commented Feb 17, 2012

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

@booo
Copy link
Contributor

booo commented Feb 17, 2012

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

@jzimmek
Copy link
Contributor Author

jzimmek commented Feb 28, 2012

fixed by #100

@jzimmek jzimmek closed this as completed Feb 28, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants