brianc / node-pg-types

Type parsing for node-postgres
270 stars 55 forks source link

fix: Normalize handling of numeric and numeric[] types #88

Closed sehrope closed 5 years ago

sehrope commented 5 years ago

Normalizes handling of numeric and numeric[] types to always return a string representation of the value for both the text and binary protocols.

Closes out #86

It's a bit of a hack as it's just converting the numeric representation to a string but seemed like the lowest impact way of making the change. Ideally the parsing logic could be tightened up to directly generate the string in a manner similar to what the backend does (see numeric_recv here: https://doxygen.postgresql.org/backend_2utils_2adt_2numeric_8c.html#a3ae98a87bbc2d0dfc9cbe3d5845e0035). I've got a WIP to handle things that way but it's a lot more code and would need more rigorous test vectors so will have to wait a bit.

sehrope commented 5 years ago

I'm closing this out and will submit a separate PR to handle just the text protocol changes.