Skip to content
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

Problems with MySQL Connector/NET (Mysql.Data) and go-mysql-server #2501

Closed
mkrautz opened this issue May 19, 2024 · 2 comments · Fixed by #2502
Closed

Problems with MySQL Connector/NET (Mysql.Data) and go-mysql-server #2501

mkrautz opened this issue May 19, 2024 · 2 comments · Fixed by #2502

Comments

@mkrautz
Copy link
Contributor

mkrautz commented May 19, 2024

Hello,

We've identified a compatibility problem in go-mysql-server when used with MySQL Connector/NET.

We have an internal ASP.NET Core project using NHibernate for which use Dolt when developing locally.

When using NHibenrate's SchemaUpdate, it eventually calls into SchemaProvider.GetIndexesAsync, which fails with an invalid cast (from Int32 -> UInt32).

Relevant code is here: https://github.com/mysql/mysql-connector-net/blob/8.4.0/MySQL.Data/src/SchemaProvider.cs#L298-L300

Seemingly, the cast from object to UInt32 would suggest that the wire-type of SEQ_IN_INDEX is uint32 instead of the current int32:
https://github.com/dolthub/go-mysql-server/blob/v0.18.1/sql/plan/show_indexes.go#L78

I tried changing this and re-building go-mysql-server and Dolt, and it worked for me. I am not sure if this is the correct fix -- but it works for us. I will submit a PR momentarily.

mkrautz added a commit to mkrautz/go-mysql-server that referenced this issue May 19, 2024
This is seemingly the correct type for this field.

MySQL Connector/NET expects this for servers >8.0.1:
https://github.com/mysql/mysql-connector-net/blob/8.4.0/MySQL.Data/src/SchemaProvider.cs#L298-L300

Fixes dolthub#2501
@mkrautz
Copy link
Contributor Author

mkrautz commented May 19, 2024

Just to clarify.

The problem we identified was the the ASP.NET server died with an invalid cast exception, stating that it cannot cast from a boxed int32 object to an uint32. A boxed type can only be cast to the type that is boxed. The code in MySQL Connector/NET therefore would suggest that the correct wire type of SEQ_IN_INDEX is in fact uint32 and not int32.

@timsehn
Copy link
Sponsor Contributor

timsehn commented May 20, 2024

We are reviewing your submitted PR now. Sorry we missed it this morning. Good bug find and fix!

jycor pushed a commit that referenced this issue May 22, 2024
* Use Uint32 for SEQ_IN_INDEX in 'SHOW INDEXES' queries.

This is seemingly the correct type for this field.

MySQL Connector/NET expects this for servers >8.0.1:
https://github.com/mysql/mysql-connector-net/blob/8.4.0/MySQL.Data/src/SchemaProvider.cs#L298-L300

Fixes #2501

---------

Co-authored-by: James Cor <james@dolthub.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants