[MDEV-23913] Prepared statement column metadata can be wrong with UNION Created: 2020-10-07 Updated: 2023-01-19 |
|
| Status: | Stalled |
| Project: | MariaDB Server |
| Component/s: | Prepared Statements |
| Affects Version/s: | 10.6 |
| Fix Version/s: | 10.6 |
| Type: | Bug | Priority: | Major |
| Reporter: | Vladislav Vaintroub | Assignee: | Dmitry Shulga |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
SELECT 1 UNION SELECT 'abc' on Prepare, Protocol::send_result_set_metadata() sends type INT to user on subsequent execution , it sends STRING in metadata. And a more complicated case CREATE TABLE t1(i INT); |
| Comments |
| Comment by Oleksandr Byelkin [ 2020-10-08 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Probably present in all current versions (have to be checked) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Vladislav Vaintroub [ 2020-10-08 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
mostly likely present in all versions, but currently affects | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2020-10-13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Critical for the other task | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2020-10-13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
proposed fix:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Vladislav Vaintroub [ 2020-10-13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The original test SELECT 1 UNION SELECT 'abc' passes alright with the proposed fix, but a more complicated one (taken from olap.test) fails . The query in question would be
One can add this test to mysql_client_test.c , to check
The type 3 (MYSQL_TYPE_LONG) changes to type 253 (MYSQL_TYPE_VAR_STRING) from prepare to execute. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Vladislav Vaintroub [ 2020-11-23 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
was closed by mistake |