[MDEV-18001] Row constructors in VALUES cause strange behaviour Created: 2018-12-13 Updated: 2022-12-07 Resolved: 2022-12-07 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | N/A |
| Affects Version/s: | 10.3 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Minor |
| Reporter: | Federico Razzoli | Assignee: | Sergei Petrunia |
| Resolution: | Cannot Reproduce | Votes: | 0 |
| Labels: | values | ||
| Description |
|
If VALUES has only 1 row and it contains at least 1 row constructor, nothing is returned:
If it has multiple rows, rows constructors become a 0-value for the first row, and the value from the previous rows for the following rows:
If VALUES is used as a subquery, the anomaly propagates:
|
| Comments |
| Comment by Federico Razzoli [ 2018-12-13 ] | ||||||||||||||||||||||||||||
|
I'm actually not saying that row constructors should be supported in this context. But if they aren't, I would expect a behaviour which is consistent with SELECT:
| ||||||||||||||||||||||||||||
| Comment by Alice Sherepa [ 2018-12-13 ] | ||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||
| Comment by Galina Shalygina (Inactive) [ 2019-01-06 ] | ||||||||||||||||||||||||||||
|
MariaDB doesn't support columns of a ROW type. So when a ROW type column is trying to be used such an error appears:
When table value constructor is defined with a ROW constructor no error is returned. Vice versa, such a query is tried to be processed and a wrong result appears or even a server crashes. To fix it fix_fields_for_tvc() should be changed. The call of check_cols(1) checks if a ROW item has exactly one column. A ROW item consists of one column (value) can be easily transformed into this value. The example will be shown below. After the changes that are described above: The result of the query where TVC is defined with a ROW constructor with one value:
With a ROW constructor with several values:
| ||||||||||||||||||||||||||||
| Comment by Alice Sherepa [ 2022-12-07 ] | ||||||||||||||||||||||||||||
|
Current 10.3 180b2bcd5389082e200f65ebc13a-10.11 return the expected error:
|