Hi, Oleksandr! On Aug 16, Oleksandr Byelkin wrote:
revision-id: adaafcf5184375369c0c4b3ccb1e82e846024ef8 (mariadb-10.3.7-137-gadaafcf5184) parent(s): 8716bb3b72b7f5fed69b6dde413c2138f6d175b2 author: Oleksandr Byelkin committer: Oleksandr Byelkin timestamp: 2018-08-16 13:55:36 +0200 message:
MDEV-16930: Crash when VALUES in derived table contains expressions
Give names to the value constructor columns as in SELECT-list.
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index f915895a260..20cea4959eb 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -13306,15 +13306,20 @@ opt_values: ;
values: - values ',' expr_or_default + values ',' remember_name expr_or_default remember_end { - if (unlikely(Lex->insert_list->push_back($3, thd->mem_root))) + if (unlikely(Lex->insert_list->push_back($4, thd->mem_root))) MYSQL_YYABORT; + // give some name in case of using in table value constuctor (TVC) + $4->set_name(thd, $3, (uint) ($5 - $3), thd->charset()); + } - | expr_or_default + | remember_name expr_or_default remember_end { - if (unlikely(Lex->insert_list->push_back($1, thd->mem_root))) + if (unlikely(Lex->insert_list->push_back($2, thd->mem_root))) MYSQL_YYABORT; + // give some name in case of using in table value constuctor (TVC) + $2->set_name(thd, $1, (uint) ($3 - $1), thd->charset()); } ;
Could you please create a special rule for that? Like named_value: remember_name expr_or_default remember_end { if (unlikely(Lex->insert_list->push_back($2, thd->mem_root))) MYSQL_YYABORT; // give some name in case of using in table value constuctor (TVC) $2->set_name(thd, $1, (uint) ($3 - $1), thd->charset()); } values: values ',' named_value | named_value ; if it'll work, that is Regards, Sergei Chief Architect MariaDB and security@mariadb.org