go-mysql-server
go-mysql-server copied to clipboard
Inserting into UINT32 column can cause error with leading 0
Repro:
CREATE TABLE test (pk BIGINT PRIMARY KEY, v1 INT UNSIGNED);
INSERT INTO test VALUES (1, "04394");
Running the above query returns the following error in the integrator https://github.com/dolthub/dolt:
INSERT INTO test VALUES (1, "04939"): unable to cast "04939" to uint64: strconv.ParseUint: parsing "04939": invalid syntax
This is due to our usage of the cast package in https://github.com/dolthub/go-mysql-server/blob/967d6031acbb42745a71f34ae65f590bc81746f7/sql/numbertype.go
We should just remove the cast package altogether and rewrite the functionality.
This bug was discovered by: https://github.com/dolthub/dolt/pull/1892
We fixed this at some point.