Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
b3e33565
Commit
b3e33565
authored
Dec 07, 2016
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix: reset MODE_NO_BACKSLASH_ESCAPES during vcol parsing
parent
a9a362d3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
0 deletions
+44
-0
mysql-test/r/func_like.result
mysql-test/r/func_like.result
+27
-0
mysql-test/t/func_like.test
mysql-test/t/func_like.test
+14
-0
sql/table.cc
sql/table.cc
+3
-0
No files found.
mysql-test/r/func_like.result
View file @
b3e33565
...
...
@@ -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;
mysql-test/t/func_like.test
View file @
b3e33565
...
...
@@ -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
;
sql/table.cc
View file @
b3e33565
...
...
@@ -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 @@ bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table,
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
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment