-
Notifications
You must be signed in to change notification settings - Fork 173
feat(c/driver/postgresql): Improve conversion of decimal to Postgresql numeric and add tests #3787
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
base: main
Are you sure you want to change the base?
feat(c/driver/postgresql): Improve conversion of decimal to Postgresql numeric and add tests #3787
Conversation
…esql numeric format logic and add test for different scales
lidavidm
left a comment
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.
The general comment I have is that it's rather hard to follow the code (albeit it was hard to follow before too). Commenting the parts and perhaps providing sample values at each stage/explaining what's going on would be valuable. It may also be good to summarize the Postgres representation in here
…3821) This PR contains: - Setup validataion suite for the postgresql driver. (128 tests pass. 0 failing. Decimal ingest test, and decimal bind tests were skipped due to bug and the fix has not been merged yet. #3787) - PostgreSQL specific test overrides - Update postgresql integration test in CI workflow to run validation tests - Update RAT license exlusions file to ignore the .lock files and test sql files. There was a small change made in the c/driver/postgresql/result_helper.cc due to the segfault when the number of query parameters doesn't match the number of result columns. The test that triggered the bug was calling get_parameter_schema() on `SELECT 1 + $1 + $2` . This query has 2 parameters but returns only 1 result column (the computed sum). The code was incorrectly using PQfname(result_, i) to retrieve parameter names, but PQfname() actually retrieves result column names from the result set. When iterating through parameters, the first iteration (i=0) would work fine accessing column 0, but the second iteration (i=1) would access an out-of-range column. PQfname() returns NULL for out-of-range column numbers, and passing this NULL pointer to AppendChild() as a C string causes the segfault.
Co-authored-by: David Li <[email protected]>
Co-authored-by: David Li <[email protected]>
Co-authored-by: David Li <[email protected]>
The logic for converting Arrow Decimal type to the PostgreSQL has been refactored to fix the data not being inserted correctly when the scale is not a multiple of 4.
Adds new test cases covering various scales and zero padding scenarios.
Closes #3485