[MDEV-25353] JSON_TABLE: Illegal mix of collations upon executing PS once, or SP/function twice Created: 2021-04-06 Updated: 2021-04-21 Resolved: 2021-04-17 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | JSON, Prepared Statements |
| Affects Version/s: | N/A |
| Fix Version/s: | 10.6.0 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Elena Stepanova | Assignee: | Alexey Botchkov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||
| Description |
|
The plain SELECT works and returns a value:
The prepared statement fails:
On MySQL both work. Also reproducible with EXECUTE IMMEDIATE and upon the 2nd execution of a stored procedure/function:
(same with a function) |
| Comments |
| Comment by Sergei Petrunia [ 2021-04-15 ] | ||||||||||||||||||||||||||
|
Ok this is how the regular SELECT query manages to work: The query starts Then, NATURAL JOIN processing is done:
Note that the Item_field constructor being called is:
Field* is passed as parameter, and the created Item_field has fixed=1 from the start. Then, execution enters Table_function_json_table::setup (). In particular, this runs this code:
Then, fix_fields is called for the ON expression:
But the Item_field objects are already fixed, so attributes are not recomputed for them. As a result, we have Item_field object which has UTF8 charset, while the field it refers to is in koi8u:
| ||||||||||||||||||||||||||
| Comment by Alexey Botchkov [ 2021-04-16 ] | ||||||||||||||||||||||||||
|
https://github.com/MariaDB/server/commit/c66589c99eac887efd28adeb0d9d6bc1b4473a87 | ||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2021-04-16 ] | ||||||||||||||||||||||||||
|
Ok to push |