-
-
Notifications
You must be signed in to change notification settings - Fork 191
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
PrepareStatement got incorrect paramsCount in response packet from mock mysql server. #1793
Comments
This is a good bug and repro. We've seen some bugs with native prepared implementation in Dolt so this may be the cause. We will fix. |
Thanks for your work, this SQL is indeed not a very common case. I temporarily solved the problem with go-mysql-driver's “interpolateParams=true” parameter. |
Hey @win5do, thanks for opening this issue and for providing the nice repro case. I debugged through this and you're absolutely right that the param count is being calculated in the vitess layer by looking for types of I'm going to try out a few ideas to fix this...
Either way, we'll get this prepared query working correctly. Glad to hear you have a good workaround with |
I debugged through this a little deeper and realized that we actually do have the right I've got a fix for this statement coded up locally and passing the repro test you provided. I'm going to tidy it up a little bit, do another round of debugging and testing to make sure I didn't miss anything, and then get the fix out for review. Thanks again for taking the time to report this so we could fix it! 🙏 |
@win5do – the fix for this issue is now available in main for go-mysql-server. Thank you for taking the time to report this and for providing such an easy repro case! 🙏 Let us know if you hit any other snags with go-mysql-server and we'll be happy to investigate. |
I use this lib to write some tests with https://github.com/jinzhu/gorm@v1.9.16 and https://github.com/go-sql-driver/mysql@v1.6.0.
A panic "sql: expected 0 arguments, got 1" occurred in grom's AutoMigrate func.
But there is no problem when I changed to a real mysql@5.7 started by docker.
After comparison, it is found that the paramsCount returned by the server is inconsistent.
The SQL is:
I write a test based on the code in dolthub/vitess:
https://github.com/dolthub/vitess/blob/73e284f11fe80760f9ef4e6afaddc00ddeaaefa5/go/mysql/conn.go#L1116
Got unexpected output:
The text was updated successfully, but these errors were encountered: