Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
ghx-label-5
Description
Currently, an ALTER VIEW statement accepts self referencing definitions. However, upon querying the altered view, the analyzer is unable to find the reference and hence throws a StackOverflowError: null error.
The expected behavior would be to throw an AnalysisException while executing the alter view statement.
Example:
[localhost:21000] default> create view foo as select * from functional.alltypes; Query: create view foo as select * from functional.alltypes Query submitted at: 2018-07-03 11:36:48 (Coordinator: http://pooja-OptiPlex-7040:25000) Query progress can be monitored at: http://pooja-OptiPlex-7040:25000/query_plan?query_id=614e03efbcb4d8b1:586a4bad00000000 +------------------------+ | summary | +------------------------+ | View has been created. | +------------------------+ Fetched 1 row(s) in 0.26s [localhost:21000] default> alter view foo as select * from foo; Query: alter view foo as select * from foo +------------------------+ | summary | +------------------------+ | View has been altered. | +------------------------+ Fetched 1 row(s) in 5.65s [localhost:21000] default> select * from foo; Query: select * from foo Query submitted at: 2018-07-03 11:37:12 (Coordinator: http://pooja-OptiPlex-7040:25000) ERROR: StackOverflowError: null
The select statement on the view fails because the analyzer can't resolve its reference. Other databases return failure during the alter view statement because stating.