[MDEV-25464] Joining CTEs inside a function fails with error code 1146 despite the tables existing Created: 2021-04-20 Updated: 2021-04-20 Resolved: 2021-04-20 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer - CTE, Stored routines |
| Affects Version/s: | 10.3.23 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Jon Kilgallon | Assignee: | Unassigned |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | CTE, Functions, query | ||
| Environment: |
Ubuntu 18.04.4 LTS (Bionic Beaver) running in Docker |
||
| Attachments: |
|
||||||||||||||||
| Issue Links: |
|
||||||||||||||||
| Description |
|
When I wrap a statement containing two or more Common Table Expressions in a function, and one of those CTEs is JOINed to another CTE, executing the function will result in error code 1146, reporting that the first table that the CTE interacts with doesn't exist - even though it does. Extracting the failing query and running it standalone works fine, the query will return the expected results. I have attached sample SQL that replicates this behaviour. |
| Comments |
| Comment by Alice Sherepa [ 2021-04-20 ] |
|
Thanks for the report! |