[MDEV-21710] No 'subquery returns more than one row' error returned but faulty result set Created: 2020-02-12 Updated: 2020-03-12 Resolved: 2020-03-12 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Manipulation - Subquery |
| Affects Version/s: | 10.4.11 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Critical |
| Reporter: | Michiel | Assignee: | Unassigned |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | need_feedback | ||
| Environment: |
Mariadb 10.4.11 on CentOs 8 |
||
| Description |
|
Mariadb 10.4.11 does not always detect a select subquery returning more than one row. In Mariadb 10.3.17 no error is returned but it seems that the order of the group_concat on strings is implicit and always the same. Adding GROUP_CONCAT(DISTINCT rel.code ORDER BY rel.code) will obtain that same result in 10.4.11.
/* Error: Subquery returns more than 1 row Result (in 10.4.11): "id","name","codes" Or "id" "name" "codes"
Returns correct (in 10.4.11) Error: Subquery returns more than 1 row |
| Comments |
| Comment by Alice Sherepa [ 2020-02-12 ] | |||||||||||||
|
Could you please explain why you consider it as a bug. The results I get on 10.4.11/10.3.21:
| |||||||||||||
| Comment by Michiel [ 2020-02-12 ] | |||||||||||||
|
Retry the query a number of times on 10.4.11 ! It will return 2 or 3 or 4 records! | |||||||||||||
| Comment by Sergei Golubchik [ 2020-02-12 ] | |||||||||||||
|
1. There can be no "Subquery returns more than 1 row" error. A subquery
can not possibly return more than one row. 2. You are getting multiple rows with the same id and name. It's because a subquery — GROUP_CONCAT, in particular — returns different results on different invocations. It can do that, because you do not have an ORDER BY clause. So the order is unspecified and can as well be different for different rows. You have to use ORDER BY if you want a stable ordering of results. |