@@ -37,6 +37,7 @@ Note: YYTHD is passed as an argument to yyparse(), and subsequently to yylex().
37
37
#define YYPS (& YYTHD->m_parser_state->m_yacc)
38
38
#define YYCSCL (YYLIP->query_charset)
39
39
#define YYMEM_ROOT (YYTHD->mem_root)
40
+ #define YYCLIENT_NO_SCHEMA (YYTHD->get_protocol()->has_client_capability(CLIENT_NO_SCHEMA))
40
41
41
42
#define YYINITDEPTH 100
42
43
#define YYMAXDEPTH 3200 /* Because of 64K stack */
@@ -9458,9 +9459,9 @@ query_primary:
9458
9459
| explicit_table
9459
9460
{
9460
9461
auto item_list= NEW_PTN PT_select_item_list;
9461
- if (item_list == nullptr ||
9462
- item_list->push_back(
9463
- NEW_PTN Item_field(@$, nullptr, nullptr, "*") ))
9462
+ auto asterisk= NEW_PTN Item_asterisk(@$, nullptr, nullptr);
9463
+ if (item_list == nullptr || asterisk == nullptr ||
9464
+ item_list->push_back(asterisk ))
9464
9465
MYSQL_YYABORT;
9465
9466
$$= NEW_PTN PT_explicit_table({}, item_list, $1);
9466
9467
}
@@ -9653,9 +9654,9 @@ select_item_list:
9653
9654
}
9654
9655
| '*'
9655
9656
{
9656
- Item *item= NEW_PTN Item_field (@$, NULL, NULL, "*" );
9657
- $$= NEW_PTN PT_select_item_list;
9658
- if ($$ == NULL || $$->push_back(item))
9657
+ Item *item = NEW_PTN Item_asterisk (@$, nullptr, nullptr );
9658
+ $$ = NEW_PTN PT_select_item_list;
9659
+ if ($$ == nullptr || item == nullptr || $$->push_back(item))
9659
9660
MYSQL_YYABORT;
9660
9661
}
9661
9662
;
@@ -14206,13 +14207,14 @@ insert_ident:
14206
14207
table_wild:
14207
14208
ident '.' '*'
14208
14209
{
14209
- $$= NEW_PTN PTI_table_wild (@$, NULL , $1.str);
14210
+ $$ = NEW_PTN Item_asterisk (@$, nullptr , $1.str);
14210
14211
}
14211
14212
| ident '.' ident '.' '*'
14212
14213
{
14213
14214
if (check_and_convert_db_name(&$1, false) != Ident_name_check::OK)
14214
14215
MYSQL_YYABORT;
14215
- $$= NEW_PTN PTI_table_wild(@$, $1.str, $3.str);
14216
+ auto schema_name = YYCLIENT_NO_SCHEMA ? nullptr : $1.str;
14217
+ $$ = NEW_PTN Item_asterisk(@$, schema_name, $3.str);
14216
14218
}
14217
14219
;
14218
14220
@@ -14268,11 +14270,9 @@ table_ident:
14268
14270
}
14269
14271
| ident '.' ident
14270
14272
{
14271
- if (YYTHD->get_protocol()->has_client_capability(CLIENT_NO_SCHEMA))
14272
- $$= NEW_PTN Table_ident(to_lex_cstring($3));
14273
- else {
14274
- $$= NEW_PTN Table_ident(to_lex_cstring($1), to_lex_cstring($3));
14275
- }
14273
+ auto schema_name = YYCLIENT_NO_SCHEMA ? LEX_CSTRING{}
14274
+ : to_lex_cstring($1.str);
14275
+ $$= NEW_PTN Table_ident(schema_name, to_lex_cstring($3));
14276
14276
if ($$ == NULL)
14277
14277
MYSQL_YYABORT;
14278
14278
}
@@ -15998,12 +15998,9 @@ grant_ident:
15998
15998
}
15999
15999
| schema '.' ident
16000
16000
{
16001
- Table_ident *tmp;
16002
- if (YYTHD->get_protocol()->has_client_capability(CLIENT_NO_SCHEMA))
16003
- tmp = NEW_PTN Table_ident(to_lex_cstring($3));
16004
- else {
16005
- tmp = NEW_PTN Table_ident(to_lex_cstring($1), to_lex_cstring($3));
16006
- }
16001
+ auto schema_name = YYCLIENT_NO_SCHEMA ? LEX_CSTRING{}
16002
+ : to_lex_cstring($1.str);
16003
+ auto tmp = NEW_PTN Table_ident(schema_name, to_lex_cstring($3));
16007
16004
if (tmp == NULL)
16008
16005
MYSQL_YYABORT;
16009
16006
LEX *lex=Lex;
0 commit comments