This task required making some changes under sf_tail in sql_yacc, which has been done. Currently the input is parsing successfully and parser is returning ER_NOT_SUPPORTED_YET error for now, which will be removed later.
diwas joshi
added a comment - This task required making some changes under sf_tail in sql_yacc, which has been done. Currently the input is parsing successfully and parser is returning ER_NOT_SUPPORTED_YET error for now, which will be removed later.
MariaDB [test]> CREATE FUNCTION f1 (col1 INT) RETURNS TABLE t1 (col1 INT) BEGIN set @a=3; end ; |
ERROR 1064 (42000): This version of MariaDB doesn't yet support '%s' near 'BEGIN set @a=3; end' at line 1
(the error text is bad but it doesnt matter because the error will be removed anyway)
Sergei Petrunia
added a comment - Ok I have tried and at least one example works:
MariaDB [test]> CREATE FUNCTION f1 (col1 INT) RETURNS TABLE t1 (col1 INT) BEGIN set @a=3; end ; |
ERROR 1064 (42000): This version of MariaDB doesn't yet support '%s' near 'BEGIN set @a=3; end' at line 1
(the error text is bad but it doesnt matter because the error will be removed anyway)
I am looking at the part of changes3.diff that relates to this MDEV, and I am seeing this change;
type_with_opt_collate was:
type_with_opt_collate:
field_type opt_collate
and now it is
type_with_opt_collate:
field_type opt_collate
| TABLE_SYM ident '(' field_list ')'
You did it, because sf_tail rule refers to type_with_opt_collate. This is reasonable, sf_tail is used for handling CREATE FUNCTION syntax, and we want to change the grammar there.
However, type_with_opt_collate is also used in other rules:
sp_param_name_and_type:
ident
type_with_opt_collate
sp_decl:
DECLARE_SYM sp_decl_idents
type_with_opt_collate
sp_opt_default
As far as I understand, these are used for declaring SP parameters and for variable declarations inside stored procedures. That is, your patch also enables things like:
CREATE PROCEDURE f1 (IN col1 TABLE foo (c2 INT)) BEGIN RETURN '123'; end ; |
which we don't want. Please change the grammar to not allow anything extra.
Sergei Petrunia
added a comment - I am looking at the part of changes3.diff that relates to this MDEV, and I am seeing this change;
type_with_opt_collate was:
type_with_opt_collate:
field_type opt_collate
and now it is
type_with_opt_collate:
field_type opt_collate
| TABLE_SYM ident '(' field_list ')'
You did it, because sf_tail rule refers to type_with_opt_collate. This is reasonable, sf_tail is used for handling CREATE FUNCTION syntax, and we want to change the grammar there.
However, type_with_opt_collate is also used in other rules:
sp_param_name_and_type:
ident
type_with_opt_collate
sp_decl:
DECLARE_SYM sp_decl_idents
type_with_opt_collate
sp_opt_default
As far as I understand, these are used for declaring SP parameters and for variable declarations inside stored procedures. That is, your patch also enables things like:
CREATE PROCEDURE f1 (IN col1 TABLE foo (c2 INT)) BEGIN RETURN '123'; end ; |
which we don't want. Please change the grammar to not allow anything extra.
The patch should include testcases. Check out tests in mysql-test/t.
you can take mysql-test/t/sp.test as an example
look for "--error" directive how to make the test expect that statement will fail with a certain error
Sergei Petrunia
added a comment - Please also
make a separate patch that only covers this MDEV.
The patch should include testcases. Check out tests in mysql-test/t.
you can take mysql-test/t/sp.test as an example
look for "--error" directive how to make the test expect that statement will fail with a certain error
This task required making some changes under sf_tail in sql_yacc, which has been done. Currently the input is parsing successfully and parser is returning ER_NOT_SUPPORTED_YET error for now, which will be removed later.