Report for week 7:

Hello!

This week I worked on the initial review for INSERT...RETURNING.  I removed some lines from my code, used select_result* instead of using with_returning_list, improved formatting, restored the structure of SQL_I_List by removing *saved_first, moved returning_list to LEX so that current_select and lex->first_select_lex() is not used, fixed the logic of my_ok() and send_eof(), and made some part more readable. Now INSERT...IGNORE is working too. For tests, I merged some test cases, removed the other ones and added some cases for existing tests. 

I also read about bison and how to use its stack to return items so that it can be used instead of list swapping.
As suggested, I am making the list rule return the List<Item> as a return value, then the rule that uses select_item_list uses something like this:
 lex->returning=$n

I have started implementing it but getting errors during build. Initially I was getting error: opt_select_expressions has no declared type 
when I tried making the entire rule return item_list.
To fix that I added opt_select_expressions to %type <item_list>
I am still trying to fix other errors.

Could you give me feedback whether I am moving along the right path, have I missed something?  

opt_select_expressions:
   /*empty*/ {$$=NULL}
  | RETURNING select_item_list
    {  //Make this entire rule return item_list
     something like:
     $$=lex->current_select->item_list
     }
     ;

Insert parser:
insert_field_spec opt_insert_update opt_select_expressions
  {
         something like
          if ($3)      
              Lex->returning_list= $3;
         
              Lex->pop_select(); //main select
              if (Lex->check_main_unit_semantics())
                   MYSQL_YYABORT;
      }
       ; 

Regards,
Rucha Deodhar

I’m protected online with Avast Free Antivirus. Get it here — it’s free forever.