[MDEV-10660] View with a window function replaces column expression with its alias, making the view invalid Created: 2016-08-24 Updated: 2017-02-05 Resolved: 2017-02-05 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer - Window functions, Views |
| Affects Version/s: | 10.2 |
| Fix Version/s: | 10.2.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | nick ivanov | Assignee: | Igor Babaev |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | 10.2-rc | ||
| Environment: |
Red Hat Enterprise Linux Server release 6.6 |
||
| Description |
|
If one creates a view that 1) contains one or more window functions as column expression and 2) provides aliases for such columns, the column expressions get replaced by the aliases in the view definition, thus rendering the view invalid. An attempt to reference such view results in "ERROR 1356 (HY000): View 'XXX' references invalid table(s) or column(s) ..." To reproduce:
Notice how the view definition has `"rnk" AS "rnk"` as the second column – the alias "rnk" replaced the column expression. It happens when you provide a column list in the view DDL – "create view blah (<column list>)" and also when you supply individual column aliases – "create view blah as select rank() over () as <alias>" |
| Comments |
| Comment by Elena Stepanova [ 2016-08-26 ] |
|
Thanks for the report. |
| Comment by Igor Babaev [ 2017-02-05 ] |
|
The fix for this bug was pushed into the 10.2 tree. |