Skip to content

Bug - insert statements fail under yet to be determined conditions #225

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

Closed
LeGEC opened this issue Apr 1, 2014 · 8 comments
Closed

Bug - insert statements fail under yet to be determined conditions #225

LeGEC opened this issue Apr 1, 2014 · 8 comments

Comments

@LeGEC
Copy link

LeGEC commented Apr 1, 2014

I stumbled on a bug involoving the interaction between the driver and MySQL.

After much trial & error, I managed to extract the following test cases :
gist : extra_mysql_test.go

This file contains 5 test cases.
On my machine : Tests 1-2-3 pass, tests 4-5 fail. I would expect the 5 tests to pass.

I would like to know if it fails on other configurations.

Go version : go1.2.1 linux/amd64
MySQL version : the original bug was triggered under MySQL 5.1.63 (Debian squeeze), and MySQL 5.5.35 (Ubuntu 13.10).

@LeGEC
Copy link
Author

LeGEC commented Apr 1, 2014

Extra details about the tests :

All cases involve the following :

  • inserting multiple rows,
  • in a table which contains a nullable column,
  • using, on the go side, sql.NullInt64 values.

What changes between the tests :

  • the number of columns in the table (TEST 1 table has 7 columns, the others have 8)
  • the number of rows inserted at once (TEST 2 inserts 9 rows, the others insert 10 rows)
  • (consequence of the two previous points :) the number of values passed along with a statement
  • some variation on what is inserted in the nullable column (null values versus non null values)

I was not able to find the exact source of the bug, but there seems to be a threshold on the amount of sent parameters, over which these insert statements start to fail.

The "tipping point" which I found is between "TEST 3" and "TEST 4" :

  • both of these tests execute a 7-columns insert statement,
  • both of these tests insert 10 rows together,
  • the only difference lies in the value inserted in the last row (9 vs NULL)

I will try to look for more details, but I am not yet familiar with the internals of the driver.

@arnehormann
Copy link
Member

I'll dig deeper into this later, but first I'd like you to comment on a hunch of mine.
Does the driver version you use include #210?
The referenced pull request also includes a test for prepared statements.

@arnehormann
Copy link
Member

@LeGEC I checked this with the current master - all your tests already pass. You are apparently using an older version of the driver. That's pretty easy - the current master is not go getable yet, the pull request is not part of a released version.
Thanks for hunting this down, the next release will contain the fix.
If you update to the most recent version and this still fails, please add a comment and I will reopen this issue.

@LeGEC
Copy link
Author

LeGEC commented Apr 1, 2014

@arnehormann The tests do indeed pass on master. Thx for the pointer. Do you have a planned release date ?

@julienschmidt
Copy link
Member

@LeGEC
Copy link
Author

LeGEC commented May 12, 2014

@arnehormann, @julienschmidt : How can I make this fix "go gettable" ?

I forked the project, how should I set up the tags on the fork so that "go get --fork--/mysql" gets me the fix ?

Thanks in advance

@julienschmidt
Copy link
Member

git tag -f go1, then push the changed tag to the repo with the --tags option

@LeGEC
Copy link
Author

LeGEC commented May 12, 2014

Thanks, worked like a charm.

btw, the fork is :

https://github.com/LeGEC/mysql

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

No branches or pull requests

3 participants