File tree Expand file tree Collapse file tree 4 files changed +62
-0
lines changed Expand file tree Collapse file tree 4 files changed +62
-0
lines changed Original file line number Diff line number Diff line change @@ -1673,3 +1673,14 @@ with columns as (select 1 as t) select * from columns;
1673
1673
t
1674
1674
1
1675
1675
use test;
1676
+ #
1677
+ # MDEV-20730: Syntax error on SELECT INTO @variable with CTE
1678
+ #
1679
+ with data as (select 1 as id)
1680
+ select id into @myid from data;
1681
+ set @save_sql_mode = @@sql_mode;
1682
+ set sql_mode="oracle";
1683
+ with data as (select 1 as id)
1684
+ select id into @myid from data;
1685
+ set sql_mode= @save_sql_mode;
1686
+ # End of 10.4 tests
Original file line number Diff line number Diff line change @@ -1182,3 +1182,18 @@ with t as (select 1 as t) select * from t;
1182
1182
with columns as (select 1 as t) select * from columns;
1183
1183
1184
1184
use test;
1185
+
1186
+
1187
+ --echo #
1188
+ --echo # MDEV-20730: Syntax error on SELECT INTO @variable with CTE
1189
+ --echo #
1190
+
1191
+ with data as (select 1 as id)
1192
+ select id into @myid from data;
1193
+ set @save_sql_mode = @@sql_mode;
1194
+ set sql_mode="oracle";
1195
+ with data as (select 1 as id)
1196
+ select id into @myid from data;
1197
+ set sql_mode= @save_sql_mode;
1198
+
1199
+ --echo # End of 10.4 tests
Original file line number Diff line number Diff line change @@ -9213,6 +9213,24 @@ select_into:
9213
9213
if (Lex->select_finalize(unit))
9214
9214
MYSQL_YYABORT;
9215
9215
}
9216
+ | with_clause
9217
+ select_into_query_specification
9218
+ {
9219
+ if (Lex->push_select($2))
9220
+ MYSQL_YYABORT;
9221
+ }
9222
+ opt_order_limit_lock
9223
+ {
9224
+ SELECT_LEX_UNIT *unit;
9225
+ if (!(unit = Lex->create_unit($2)))
9226
+ MYSQL_YYABORT;
9227
+ if ($4)
9228
+ unit= Lex->add_tail_to_query_expression_body(unit, $4);
9229
+ unit->set_with_clause($1);
9230
+ $1->attach_to($2);
9231
+ if (Lex->select_finalize(unit))
9232
+ MYSQL_YYABORT;
9233
+ }
9216
9234
;
9217
9235
9218
9236
simple_table:
Original file line number Diff line number Diff line change @@ -9314,6 +9314,24 @@ select_into:
9314
9314
if (Lex->select_finalize(unit))
9315
9315
MYSQL_YYABORT;
9316
9316
}
9317
+ | with_clause
9318
+ select_into_query_specification
9319
+ {
9320
+ if (Lex->push_select($2))
9321
+ MYSQL_YYABORT;
9322
+ }
9323
+ opt_order_limit_lock
9324
+ {
9325
+ SELECT_LEX_UNIT *unit;
9326
+ if (!(unit = Lex->create_unit($2)))
9327
+ MYSQL_YYABORT;
9328
+ if ($4)
9329
+ unit= Lex->add_tail_to_query_expression_body(unit, $4);
9330
+ unit->set_with_clause($1);
9331
+ $1->attach_to($2);
9332
+ if (Lex->select_finalize(unit))
9333
+ MYSQL_YYABORT;
9334
+ }
9317
9335
;
9318
9336
9319
9337
You can’t perform that action at this time.
0 commit comments