go-mysql-server icon indicating copy to clipboard operation
go-mysql-server copied to clipboard

Inserting into UINT32 column can cause error with leading 0

Open Hydrocharged opened this issue 4 years ago • 1 comments

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.

Hydrocharged avatar Jul 02 '21 22:07 Hydrocharged

This bug was discovered by: https://github.com/dolthub/dolt/pull/1892

Hydrocharged avatar Jul 02 '21 22:07 Hydrocharged

We fixed this at some point.

zachmu avatar Oct 06 '22 22:10 zachmu