← Back to team overview

maria-developers team mailing list archive

Re: Please review mdev-19956

 

  Hi Igor,

I have the following suggestions so far.
Can you please fix them and replace the commit in bb-10.4-igor?



1. In statements where subquery is not allowed, the error message become confusing:

EXECUTE stmt USING (SELECT 1);

< ERROR 1064 (42000): ... syntax to use near 'SELECT 1)' at line 1
> ERROR 1064 (42000): ... syntax to use near ')' at line 1

Please change SELECT and WITH to have the '<kwd>' type, like this:

%token <kwd> SELECT_SYM                    /* SQL-2003-R */
%token <kwd> WITH                          /* SQL-2003-R */

Then in the grammar like this:

query_specification_start:
          SELECT_SYM
          {
            SELECT_LEX *sel;
            LEX *lex= Lex;
            if (!(sel= lex->alloc_select(TRUE)) ||
                  lex->push_select(sel))
              MYSQL_YYABORT;
            sel->init_select();
            sel->braces= FALSE;

you will be able to use $1.pos() to get the position of the keyword,
and later use this position to generate the error properly.


2. The change in sql_cte.cc is not relevant to this task.
Please make a separate MDEV for this and push it to 10.4, then rebase MDEV-19956.


3. There are a few mistakes in comments:

+   <query expression body> ::
+       <query term>
+     | <query expression body> UNION [ ALL | DISTINCT ] <query term>
+     | <query expression body> EXCEPT [ DISTINCT ]

+  Consider the production rule of the SQL Standard
+     subquery:
+        '(' query_expression_no_with_clause ')'


+  The latter can be re-written into
+     subquery:
+          '(' query_expression_body_ext_parens ')'
+        | '(' with_clause query_expression_no_with_clause ')'

Please fix them as discussed on slack.


Thanks.