[MDEV-33105] missing column name restricted by a sub-select results to wrong dataset instead of error Created: 2023-12-21 Updated: 2023-12-24 Resolved: 2023-12-24 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Definition - Temporary, Server |
| Affects Version/s: | 10.11.4 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Serg G. Brester | Assignee: | Unassigned |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | with | ||
| Environment: |
debian 12 |
||
| Description |
|
Trying to follow an obscure statement, I created another one that provided weird incorrect result. Simplified variant looks like:
that "mistakenly" resulting to:
however initially expected this (row 1 was unexpected):
however after attentive view the expectation is an error: Although the reason for that was a "mistake" from my side: forgotten the commented part as id that provides a column id to the xxx-statement, the wrong result is totally unexpected here. By the way it looks like the union-ing in the second with-statement tab plays an important role by the issue, because somehow it seems to "follow" the column name id from this second statement (after union) in a sub-select to the first one (just doing it wrong). If one rewrite it like this (with a column col instead of id which then completely missed in with-statements:
it would fail as expected with an error: So a conjunction to id by a with-statement + union seems to arise there internally. |
| Comments |
| Comment by Serg G. Brester [ 2023-12-21 ] | ||||
|
Thinking about that a bit, I guess the behavior is correct - the column id exists in context of whole select (it simply means the id of main), so it simply quasi the same as this:
and has nothing to do with a with-statement "conjunction" that I thought existed here. So basically it is weird constellation but fully correct result for that statement. I was just confused by a large statement on that I working before what after all resulted to a wrong simplification and incorrect assumption. Thus can be closed as incorrect. |