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

Incorrect handling of leading zeroes during INSERT #54380

Closed
evillique opened this issue Sep 7, 2023 · 1 comment · Fixed by #55575 or #59403
Closed

Incorrect handling of leading zeroes during INSERT #54380

evillique opened this issue Sep 7, 2023 · 1 comment · Fixed by #55575 or #59403

Comments

@evillique
Copy link
Member

How to reproduce

CREATE TABLE EMPLOYEE
(
    `empId` INTEGER PRIMARY KEY,
    `d` DOUBLE
)
ENGINE = MergeTree
ORDER BY empId;

INSERT INTO EMPLOYEE VALUES (0001, 1.456), (0005, 45.98), (0008, 4342.766), (0017, 345.87), (0021, 43.78), (0051, 0.781);

SELECT * FROM EMPLOYEE;

Results into

┌─empId─┬────────d─┐
│     1 │    1.456 │
│     5 │    45.98 │
│     8 │ 4342.766 │
│    15 │   345.87 │
│    17 │    43.78 │
│    41 │    0.781 │
└───────┴──────────┘

Expected behavior

┌─empId─┬────────d─┐
│     1 │    1.456 │
│     5 │    45.98 │
│     8 │ 4342.766 │
│    17 │   345.87 │
│    21 │    43.78 │
│    51 │    0.781 │
└───────┴──────────┘

Reproduces on the latest master:
https://fiddle.clickhouse.com/8d27f2fe-31a8-4af5-a54b-c0d1608886db

@evillique evillique added the potential bug To be reviewed by developers and confirmed/rejected. label Sep 7, 2023
@alexey-milovidov
Copy link
Member

The numbers are mistakenly parsed as octal. We shouldn't do that - octal numbers are harmful, as well as functions like strto* from C.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants