Skip to content
This repository has been archived by the owner on Jan 28, 2021. It is now read-only.

Fixed INSERT bugs, added UINT64 support, and added tests #816

Merged
merged 2 commits into from
Sep 13, 2019

Conversation

Hydrocharged
Copy link
Contributor

I found some bugs for INSERT statements, and implemented a few tests as well (some specific to the bug fixes, others for general INSERT testing).

One bug dealt with integer values greater than an INT64. By default, all numbers are parsed to INT64, meaning that a column with type sql.Uint64 cannot actually hold the entire range. I added another check that only attempts to parse as a UINT64 in the event that the INT64 parsing fails.

Another bug dealt with the absence of columns in an INSERT statement. For example: INSERT INTO tablename VALUES ... would parse as an empty column list, rather than the entire column list. This behavior has been fixed.

Another bug dealt with a mismatch between the number of columns supplied and the number of values supplied for an INSERT statement. This has also been fixed.

The last bug dealt with the smallest integer types. The Convert function was missing entries for those types, and causing inserts on those columns to fail that should otherwise be valid. This has also been fixed.

Signed-off-by: Daylon Wilkins <daylon@liquidata.co>
@erizocosmico erizocosmico requested a review from a team September 12, 2019 07:16
Signed-off-by: Daylon Wilkins <daylon@liquidata.co>
@Hydrocharged
Copy link
Contributor Author

Hydrocharged commented Sep 12, 2019

Hey everyone! I apologize for adding another commit to this PR rather than making a new one, but it builds on this one and I wasn't sure how to create a PR to point to this branch but show up as being linked to this PR.

I found two more small INSERT bugs that I implemented fixes for. The first was that, when a column list is provided, there are no checks for whether the columns exist or not. The second was that a column could be duplicated in the column list. Both of those issues were fixed, and a test was added for each as well.

Copy link
Contributor

@agarciamontoro agarciamontoro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job, thank you!

@ajnavarro ajnavarro merged commit 98c7c11 into src-d:master Sep 13, 2019
@Hydrocharged Hydrocharged deleted the insert-fixes branch September 13, 2019 17:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants