8000 Fix double precision out of range during COPY. by shubhamdhama · Pull Request #281 · dimitri/pgcopydb · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix double precision out of range during COPY. #281

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

Merged
merged 2 commits into from
May 11, 2023

Conversation

shubhamdhama
Copy link
Contributor

We have identified the root cause of the issue where double precision values were going out of range during the COPY operation. It turns out that we were missing the extra_float_digits GUC (grand unified configuration) while copying the float8 data. As a result, when extreme values like '1.7976931348623157E+308' were copied from the source, an overflow occurred leading to the following error:

2023-05-08 14:17:00 16666 ERROR  pgsql.c:2555              TARGET [22003] ERROR:  "1.79769313486232e+308" is out of range for type double precision
2023-05-08 14:17:00 16666 ERROR  pgsql.c:2559              TARGET CONTEXT:  COPY t_numeric_types, line 46650, column c_double_precision: "1.79769313486232e+308"
2023-05-08 14:17:00 16666 ERROR  pgsql.c:2563              TARGET Context: Failed to copy data to target

Value of 3 is inspired from pg_dump https://github.com/postgres/postgres/blob/ff4213cdc2e2bef7fadba6db2fc97057fd03be74/src/bin/pg_dump/pg_dump.c#L1176

We have identified the root cause of the issue where double precision values were going out of range during the COPY operation. It turns out that we were missing the extra_float_digits GUC (grand unified configuration) while copying the float8 data. As a result, when extreme values like '1.7976931348623157E+308' were copied from the source, an overflow occurred leading to the following error:

```log
2023-05-08 14:17:00 16666 ERROR  pgsql.c:2555              TARGET [22003] ERROR:  "1.79769313486232e+308" is out of range for type double precision
2023-05-08 14:17:00 16666 ERROR  pgsql.c:2559              TARGET CONTEXT:  COPY t_numeric_types, line 46650, column c_double_precision: "1.79769313486232e+308"
2023-05-08 14:17:00 16666 ERROR  pgsql.c:2563              TARGET Context: Failed to copy data to target
```
@shubhamdhama shubhamdhama force-pushed the fix-float8-overflow branch from ecc1d3d to 9466b1c Compare May 8, 2023 09:36
@dimitri dimitri merged commit d807507 into dimitri:main May 11, 2023
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

Successfully merging this pull request may close these issues.

2 participants
0