Open lukaslihotzki opened 7 years ago
Hey @lukaslihotzki I appreciate the pull request! Would you be able to provide a test for this? Otherwise I'm not going to be able to accept a patch because the risk of regressions is too high!
Thanks again! ❤️ 😄
Writing the test I noticed buffers in results still are passed as hex strings, but passing raw buffers there would require much more refactoring across different libraries (at least node-pg-types and node-libpq) and then everything, including numbers, etc., had to be parsed from binary. At least, this commit makes node-postgres interface consistent (buffers as parameters and buffers as result).
Is this getting merged? Would be happy to contribute more tests if that's what's holding it back!
We ran into this problem trying to store user-generated CSV files with native bindings on node-postgres. Having a \
(backslash) in a parameter can fail with
ERROR: invalid input syntax for type bytea
Non-native bindings handle this fine and do exactly the same as this pull request (source).
Without this commit, buffers passed as parameters are processed like null-terminated strings.