Closed nicktobey closed 3 weeks ago
Notably, while the above statement is invalid, some statements with multiple nested sub-statements are valid. The following statements are valid MySQL:
mysql> create procedure foo() create view v as select 1;
Query OK, 0 rows affected (0.01 sec)
mysql> create procedure foo() create table t as select 1;
Query OK, 0 rows affected (0.00 sec)
But both fail in Dolt. Curiously, neither is a panic:
json/main*> create procedure foo() create view v as select 1;
unable to get sub statement
json/main*> create procedure foo() create table t as select 1;
creating tables in stored procedures is currently unsupported and will be added in a future release
For the case of creating a view inside a procedure, it would be a panic, just like the previous ones, but there's an additional check in the logic for CREATE VIEW
that detects the out-of-bounds access and makes it an error instead.
The following invalid query will be successfully parsed and then cause a panic during plan building:
CREATE PROCEDURE foo() CREATE PROCEDURE foo() SELECT 0;
Stack trace: