-
Notifications
You must be signed in to change notification settings - Fork 383
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
Replace JSON_EXTRACT utilisation with JSON_VALUE #1897
Comments
As a really naive approach, i replaced all Test results:
with my changes:
i think I've got failed test because of my mysql config (most of my failed test broke because of : System.Security.Authentication.AuthenticationException : Authentication failed because the remote party sent a TLS alert: 'IllegalParameter')... but i would gladly make a PR... if it's something doable (i just need to know witch branch to target) |
@Angelinsky7 Thanks for making us aware of this issue. We have implemented a workaround/fix for this issue in #1899, which is likely to be backported to |
@lauxjpn sorry for the noise, i should have read better #1899 .... Do you think it would be possible to target Thanks ! |
@Angelinsky7 That is the plan.
The This issue is actually a bit more involved than we initially anticipated, because of the differences in how While we are at it, we are going to improve the So the complexities here are the reason for why we haven't merged #1899 yet and are still working on it. It is probably best in this case here that I complete the works on the the fixes and improvements myself, since I am already in the middle of it. Thanks! |
@lauxjpn tell me if i can do something to help you, i would be happy to do my part ! |
hello @lauxjpn, i hope your well ! Do you have any news for this to happen in the near future ? i really would love to be able to fully use json object in |
Hello @lauxjpn |
So i made this branch: https://github.com/Angelinsky7/Pomelo.EntityFrameworkCore.MySql/tree/8.0-maint-json-value-%231897 We should add an option to users like that they could choose (for the whole connection, like _option: IMySqlOptions) If @lauxjpn you are OK with this approach i can do it.... (and when you'll finish refactoring all this code for 9.x.x and backport it you'll remove this) |
Steps to reproduce
Run the custom project to see it crashing
PomeloBugJsonExtract.zip
The issue
In some places, in the code,
JSON_EXTRACT
is used for getting value of a JSON field when using projection or any other mean of directly getting data. But when the data isnull
,JSON_EXTRACT
does return the string value"null"
instead of the mysqlnull
value, as intended in the spec : https://bugs.mysql.com/bug.php?id=85755Sadly if you have a
Nullable<Datetime>
later in ef core when trying to convert it will use the string representation instead of the correctnull
value and crash withbe aware that the
null
indication here is not a real null value but instead a string"null"
inhttps://github.com/mysql-net/MySqlConnector/blob/1d508bcfd74f221e71a892bbb3086a545f1a5451/src/MySqlConnector/Core/Row.cs#L326-L342
The naive solution
If we replace all call with
JSON_VALUE
we get a correct null value instead of a string and "everything" seems to work correctlyFurther technical details
MySQL version: 8.3.0-1.el8
Operating system: Window11
Pomelo.EntityFrameworkCore.MySql version: 8.0.2
The text was updated successfully, but these errors were encountered: