Skip to content
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

precision issues on MariaDB 10.2.x #205

Closed
mia0x75 opened this issue Dec 11, 2017 · 1 comment · Fixed by #222
Closed

precision issues on MariaDB 10.2.x #205

mia0x75 opened this issue Dec 11, 2017 · 1 comment · Fixed by #222

Comments

@mia0x75
Copy link

mia0x75 commented Dec 11, 2017

Server is running MariaDB 10.2.11 w/ CentOS 7.x

Table schemas:

CREATE TABLE `dt_decimal_1` (
  `c` decimal(38,0) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE `dt_decimal_2` (
  `c` decimal(38,19) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE `dt_decimal_3` (
  `c` decimal(38,38) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4

insert data

INSERT INTO dt_decimal_1 VALUES (99999999999999999999999999999999999999);
INSERT INTO dt_decimal_2 VALUES (9999999999999999999.9999999999999999999);
INSERT INTO dt_decimal_3 VALUES (0.99999999999999999999999999999999999999);

go-canal output:

================================================================================
Table:          drafts.dt_decimal_1
Action:         insert
Rows:           [[1e+38]]
================================================================================
Table:          drafts.dt_decimal_2
Action:         insert
Rows:           [[1e+19]]
================================================================================
Table:          drafts.dt_decimal_3
Action:         insert
Rows:           [[1]]
@siddontang
Copy link
Collaborator

I use float64 to save the decimal value, this may lose the precision, but I have no time to improve it. Maybe it is better to find a good decimal implementation to fully support this.

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 a pull request may close this issue.

2 participants