-
Notifications
You must be signed in to change notification settings - Fork 606
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use empty parsing context to build view's select in CREATE VIEW statement #2049
Conversation
queries in CREATE VIEW statement and for selecting from the views Preliminary validation is done by adding "query_ast" node to the builded AST of the CREATE VIEW statement. It does not surve any real purpose (it is not persisted in the scheme) as of now except early validation of view queries.
⚪
|
⚪
|
…ment (#2049) (#2595) Based on: #2049 KIKIMR-20891 CREATE VIEW statement parses (and validates) the select statement saved in the view. It should be parsed in a context isolated from the statements executed before the CREATE VIEW statement (we haven't decided yet on the exact scope of the context of the view's select statement, see [KIKIMR-20656](https://st.yandex-team.ru/KIKIMR-20656)). It is pretty obvious that one should be able to execute the following statement in one go ("one go" = one press of a "run" button in YDB UI): ```sql -- create view NecessaryInnerView with (security_invoker = true) as select 1; -- create view ContextTestingView with (security_invoker = true) as select * from `/local/NecessaryInnerView`; -- where `/local/...` is your cluster name drop view ContextTestingView; create view ContextTestingView with (security_invoker = true) as select * from `/local/NecessaryInnerView`; ``` However, executing both drop view and create view in one go currently produces and error: ``` DropObject is not yet implemented for intent determination transformer ``` which indicates that the context of the inner query: ```sql select * from `/local/NecessaryInnerView` ``` is polluted by the previous: ```sql drop view ContextTestingView; ``` statement. This problem is fixed by using an empty parsing context for parsing view's inner select statement during handling of CREATE VIEW statement.
KIKIMR-20891
CREATE VIEW statement parses (and validates) the select statement saved in the view. It should be parsed in a context isolated from the statements executed before the CREATE VIEW statement (we haven't decided yet on the exact scope of the context of the view's select statement, see KIKIMR-20656). It is pretty obvious that one should be able to execute the following statement in one go ("one go" = one press of a "run" button in YDB UI):
However, executing both drop view and create view in one go currently produces and error:
which indicates that the context of the inner query:
is polluted by the previous:
statement.
This problem is fixed by using an empty parsing context for parsing view's inner select statement during handling of CREATE VIEW statement.