diwas, It would be nice if you submitted a separate patch for this task. The patch should do what is described in the description, and nothing else.
The patch you've sent as "changes3.diff" is not good - it does a part of this task, a part of MDEV-8344, and maybe something else. When I applied your patch and tried to run the query
select * from table_func('abc');
|
I got this crash:
Program received signal SIGSEGV, Segmentation fault.
|
[Switching to Thread 0x7ffff7eb8700 (LWP 10443)]
|
0x0000555555be4eec in MYSQLparse (thd=0x55555ab07b90) at /home/psergey/dev-git/10.1-gsoc/sql/sql_yacc.yy:10826
|
(gdb) p sel
|
$2 = (SELECT_LEX *) 0x0
|
(gdb) p sel->get_item_list()
|
Cannot access memory at address 0x0
|
(gdb) wher
|
#0 0x0000555555be4eec in MYSQLparse (thd=0x55555ab07b90) at /home/psergey/dev-git/10.1-gsoc/sql/sql_yacc.yy:10826
|
#1 0x0000555555a26e62 in parse_sql (thd=0x55555ab07b90, parser_state=0x7ffff7eb7110, creation_ctx=0x0, do_pfs_digest=true) at /home/psergey/dev-git/10.1-gsoc/sql/sql_parse.cc:9103
|
#2 0x0000555555a22ea5 in mysql_parse (thd=0x55555ab07b90, rawbuf=0x7fff500051b8 "select * from table_func('abc')", length=31, parser_state=0x7ffff7eb7110) at /home/psergey/dev-git/10.1-gsoc/sql/sql_parse.cc:7116
|
#3 0x0000555555a12061 in dispatch_command (command=COM_QUERY, thd=0x55555ab07b90, packet=0x55555ab0f2f1 "select * from table_func('abc')", packet_length=31) at /home/psergey/dev-git/10.1-gsoc/sql/sql_parse.cc:1462
|
#4 0x0000555555a10e2b in do_command (thd=0x55555ab07b90) at /home/psergey/dev-git/10.1-gsoc/sql/sql_parse.cc:1090
|
#5 0x0000555555b3dd04 in do_handle_one_connection (thd_arg=0x55555ab07b90) at /home/psergey/dev-git/10.1-gsoc/sql/sql_connect.cc:1347
|
#6 0x0000555555b3da49 in handle_one_connection (arg=0x55555ab07b90) at /home/psergey/dev-git/10.1-gsoc/sql/sql_connect.cc:1258
|
#7 0x00007ffff691de9a in start_thread (arg=0x7ffff7eb8700) at pthread_create.c:308
|
#8 0x00007ffff604e3fd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
|
#9 0x0000000000000000 in ?? ()
|
This task required adding another rule for, using table functions in select queries, under table_factor in sql_yacc, but that was creating shift/reduce conflicts. Based on my discussion with Sergei on irc, we realized the problem seems to be in how the grammar handles bison's limitations. So we fixed it by factoring out the conflicting code in two rules into table_factor_part2. This fixed the problem. There was one more requirement of checking if the parameters are base constants or not. This was done by iterating over item_list and using basic_const_item(). Finally the input is getting parsed.