-
Notifications
You must be signed in to change notification settings - Fork 93
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
feat(c/driver/postgresql): Handle NUMERIC type by converting to string #883
Conversation
return EINVAL; | ||
} | ||
|
||
if (special_value.size() > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: !special_value.empty()
} | ||
|
||
// Calculate string space requirement | ||
int64_t max_chars_required = std::max<int64_t>(1, weight + 1 * kDecDigits); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the 1 *
necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! (Was a typo 😬 )
Closes #767.
This PR implements NUMERIC Postgres columns by converting them to strings. This is not ideal but there is also no Arrow type that can be easily computed before an entire column of Postgres numerics has been resolved. A future extension could attempt decimal conversion in the driver but for now a string value is better than is what currently gets returned (a blob of the COPY data).
Example support via the R bindings:
Created on 2023-07-08 with reprex v2.0.2