[CONJ-836] Single Update with nested functions where internal functions return distinct values are returning identical values Created: 2020-10-26 Updated: 2020-12-01 Resolved: 2020-12-01 |
|
| Status: | Closed |
| Project: | MariaDB Connector/J |
| Component/s: | JDBC compatibility |
| Affects Version/s: | 2.3.0, 2.2.4, 2.4.0, 2.5.0, 2.6.0, 2.7.0 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Davi de Paula Cavalcanti | Assignee: | Diego Dupin |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | None | ||
| Environment: |
MacOS 10.14.6, AWS Aurora (MySQL), MySQL 5.7 |
||
| Attachments: |
|
||||||||||||
| Issue Links: |
|
||||||||||||
| Description |
|
I'm trying to update the Java connector in one of my applications from version 2.2.3 to 2.2.4.
Up to version 2.2.3, this SQL would set a distinct value to `new_id` in each of the rows in the table. If I run the statement directly on MySQL server (using mysql>), the result is always as expected (distinct values on each row). I've written a very simple Java application to replicate the issue and do some investigation myself. From running the application it is clear that the problem is not really with the call to `UUID()`. It is `REPLACE(UUID())` that causes identical values to be returned on 2.2.4. Is there some parameter I must pass for that to work correctly from 2.2.4? P.S.: In case you want to run the attached application: 1 - connect to each of the DBs and run the following queries:
2 - replace the connection info masked for security reasons and run it on each of the DBs. 3 - set the version of mariadb client to use in the test in build.gradle 4 - run main() If the output shows 3 for each of the distinct queries, the update stmt created distinct values in each column. If it shows 1, the update set the same value to all rows for that column. The queries should all return 3. What I saw, for all DBs: With mariadb client 2.2.3, it returns 3 for all queries. |
| Comments |
| Comment by Davi de Paula Cavalcanti [ 2020-10-26 ] | ||||||||||||||||||||||||||
|
This seems to have happened to others as well: | ||||||||||||||||||||||||||
| Comment by Davi de Paula Cavalcanti [ 2020-10-26 ] | ||||||||||||||||||||||||||
|
After some more investigation, it seems to be related to this: Source: https://stackoverflow.com/a/51393124/5154619 | ||||||||||||||||||||||||||
| Comment by Davi de Paula Cavalcanti [ 2020-10-27 ] | ||||||||||||||||||||||||||
|
https://jira.mariadb.org/browse/CONJ-417 helped a lot, as I could not change the databases that had already been created. | ||||||||||||||||||||||||||
| Comment by Diego Dupin [ 2020-11-17 ] | ||||||||||||||||||||||||||
|
I failed to reproduce the issue, whatever the server I use and connector version.
| ||||||||||||||||||||||||||
| Comment by Davi de Paula Cavalcanti [ 2020-11-18 ] | ||||||||||||||||||||||||||
|
Hi Diego, thank you for looking into this! I've added the queries to the test program, and this was the output:
| ||||||||||||||||||||||||||
| Comment by Diego Dupin [ 2020-11-18 ] | ||||||||||||||||||||||||||
|
Ok, with your comment, the problem reside in server part : ID: 1, new_ID: f117abd2-2930-11eb-904c-85ca6393b8de, new_ID2: f117aac4293011eb904c85ca6393b8de, new_ID3: F117AAD8293011EB904C85CA6393B8DE, new_ID2 and new_ID3 get the exact same generated UUID Value. | ||||||||||||||||||||||||||
| Comment by Davi de Paula Cavalcanti [ 2020-11-20 ] | ||||||||||||||||||||||||||
|
Yes, I wrote that test program to demonstrate that (on the previous version of the library it doesn't happen). I've tested on: | ||||||||||||||||||||||||||
| Comment by Diego Dupin [ 2020-12-01 ] | ||||||||||||||||||||||||||
|
Problem reside in mysql 5.7 that evaluate UUID() only once when using UTF8MB4 charset. just an example to reproduced (only SQL)
| ||||||||||||||||||||||||||
| Comment by Diego Dupin [ 2020-12-01 ] | ||||||||||||||||||||||||||
|
just reported here https://bugs.mysql.com/bug.php?id=101820 |