mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
bugfix: reset MODE_NO_BACKSLASH_ESCAPES during vcol parsing
This commit is contained in:
@ -262,3 +262,30 @@ select * from v1;
|
||||
'foo!' like 'foo!!' 'foo!' like 'foo!!' escape '!'
|
||||
0 1
|
||||
drop view v1;
|
||||
create table t1 (a varchar(100),
|
||||
b int default (a like '%f\\_'),
|
||||
c int default (a like '%f\\_' escape ''),
|
||||
d int default (a like '%f\\_' escape '\\'));
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` varchar(100) DEFAULT NULL,
|
||||
`b` int(11) DEFAULT (`a` like '%f\\_'),
|
||||
`c` int(11) DEFAULT (`a` like '%f\\_' escape ''),
|
||||
`d` int(11) DEFAULT (`a` like '%f\\_' escape '\\')
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
insert t1 (a) values ('1 f_'), ('1 f\\_');
|
||||
set sql_mode=no_backslash_escapes;
|
||||
insert t1 (a) values ('2 f_'), ('2 f\_');
|
||||
flush tables;
|
||||
insert t1 (a) values ('3 f_'), ('3 f\_');
|
||||
set sql_mode=default;
|
||||
select * from t1;
|
||||
a b c d
|
||||
1 f_ 1 0 1
|
||||
1 f\_ 0 1 0
|
||||
2 f_ 1 0 1
|
||||
2 f\_ 0 1 0
|
||||
3 f_ 1 0 1
|
||||
3 f\_ 0 1 0
|
||||
drop table t1;
|
||||
|
@ -193,3 +193,17 @@ create view v1 as select 'foo!' like 'foo!!', 'foo!' like 'foo!!' escape '!';
|
||||
show create view v1;
|
||||
select * from v1;
|
||||
drop view v1;
|
||||
|
||||
create table t1 (a varchar(100),
|
||||
b int default (a like '%f\\_'),
|
||||
c int default (a like '%f\\_' escape ''),
|
||||
d int default (a like '%f\\_' escape '\\'));
|
||||
show create table t1;
|
||||
insert t1 (a) values ('1 f_'), ('1 f\\_');
|
||||
set sql_mode=no_backslash_escapes;
|
||||
insert t1 (a) values ('2 f_'), ('2 f\_');
|
||||
flush tables;
|
||||
insert t1 (a) values ('3 f_'), ('3 f\_');
|
||||
set sql_mode=default;
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
@ -995,6 +995,7 @@ bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table,
|
||||
Field **vfield_ptr= table->vfield;
|
||||
Field **dfield_ptr= table->default_field;
|
||||
Virtual_column_info **check_constraint_ptr= table->check_constraints;
|
||||
sql_mode_t saved_mode= thd->variables.sql_mode;
|
||||
Query_arena backup_arena;
|
||||
Virtual_column_info *vcol;
|
||||
StringBuffer<MAX_FIELD_WIDTH> expr_str;
|
||||
@ -1020,6 +1021,7 @@ bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table,
|
||||
thd->stmt_arena= table->expr_arena;
|
||||
thd->update_charset(&my_charset_utf8mb4_general_ci, table->s->table_charset);
|
||||
expr_str.append(&parse_vcol_keyword);
|
||||
thd->variables.sql_mode &= ~MODE_NO_BACKSLASH_ESCAPES;
|
||||
|
||||
while (pos < end)
|
||||
{
|
||||
@ -1135,6 +1137,7 @@ end:
|
||||
thd->stmt_arena= backup_stmt_arena_ptr;
|
||||
if (save_character_set_client)
|
||||
thd->update_charset(save_character_set_client, save_collation);
|
||||
thd->variables.sql_mode= saved_mode;
|
||||
DBUG_RETURN(res);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user