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
5e34724a
Commit
5e34724a
authored
Dec 31, 2003
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#2244 User variables collation conflict is not detected
parent
11d5428b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
1 deletion
+75
-1
mysql-test/r/user_var.result
mysql-test/r/user_var.result
+42
-0
mysql-test/t/user_var.test
mysql-test/t/user_var.test
+28
-0
sql/item_func.cc
sql/item_func.cc
+5
-1
No files found.
mysql-test/r/user_var.result
View file @
5e34724a
...
...
@@ -120,3 +120,45 @@ select @a+0, @a:=@a+0+count(*), count(*), @a+0 from t1 group by i;
1 3 2 0
3 6 3 0
drop table t1;
set @a=_latin2'test';
select charset(@a),collation(@a),coercibility(@a);
charset(@a) collation(@a) coercibility(@a)
latin2 latin2_general_ci 3
select @a=_latin2'TEST';
@a=_latin2'TEST'
1
select @a=_latin2'TEST' collate latin2_bin;
@a=_latin2'TEST' collate latin2_bin
0
set @a=_latin2'test' collate latin2_general_ci;
select charset(@a),collation(@a),coercibility(@a);
charset(@a) collation(@a) coercibility(@a)
latin2 latin2_general_ci 0
select @a=_latin2'TEST';
@a=_latin2'TEST'
1
select @a=_latin2'TEST' collate latin2_bin;
ERROR HY000: Illegal mix of collations (latin2_general_ci,EXPLICIT) and (latin2_bin,EXPLICIT) for operation '='
select charset(@a:=_latin2'test');
charset(@a:=_latin2'test')
latin2
select collation(@a:=_latin2'test');
collation(@a:=_latin2'test')
latin2_general_ci
select coercibility(@a:=_latin2'test');
coercibility(@a:=_latin2'test')
3
select collation(@a:=_latin2'test' collate latin2_bin);
collation(@a:=_latin2'test' collate latin2_bin)
latin2_bin
select coercibility(@a:=_latin2'test' collate latin2_bin);
coercibility(@a:=_latin2'test' collate latin2_bin)
0
select (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST';
(@a:=_latin2'test' collate latin2_bin) = _latin2'TEST'
0
select charset(@a),collation(@a),coercibility(@a);
charset(@a) collation(@a) coercibility(@a)
latin2 latin2_bin 0
select (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST' collate latin2_general_ci;
ERROR HY000: Illegal mix of collations (latin2_bin,EXPLICIT) and (latin2_general_ci,EXPLICIT) for operation '='
mysql-test/t/user_var.test
View file @
5e34724a
...
...
@@ -71,3 +71,31 @@ select @a:=0; select @a, @a:=@a+count(*), count(*), @a from t1 group by i;
select
@
a
:=
0
;
select
@
a
+
0
,
@
a
:=@
a
+
0
+
count
(
*
),
count
(
*
),
@
a
+
0
from
t1
group
by
i
;
drop
table
t1
;
#
# Bug #2244: User variables didn't copy collation and derivation
# attributes from values they were initialized to.
#
set
@
a
=
_latin2
'test'
;
select
charset
(
@
a
),
collation
(
@
a
),
coercibility
(
@
a
);
select
@
a
=
_latin2
'TEST'
;
select
@
a
=
_latin2
'TEST'
collate
latin2_bin
;
set
@
a
=
_latin2
'test'
collate
latin2_general_ci
;
select
charset
(
@
a
),
collation
(
@
a
),
coercibility
(
@
a
);
select
@
a
=
_latin2
'TEST'
;
--
error
1266
select
@
a
=
_latin2
'TEST'
collate
latin2_bin
;
#
# Check the same invoking Item_set_user_var
#
select
charset
(
@
a
:=
_latin2
'test'
);
select
collation
(
@
a
:=
_latin2
'test'
);
select
coercibility
(
@
a
:=
_latin2
'test'
);
select
collation
(
@
a
:=
_latin2
'test'
collate
latin2_bin
);
select
coercibility
(
@
a
:=
_latin2
'test'
collate
latin2_bin
);
select
(
@
a
:=
_latin2
'test'
collate
latin2_bin
)
=
_latin2
'TEST'
;
select
charset
(
@
a
),
collation
(
@
a
),
coercibility
(
@
a
);
--
error
1266
select
(
@
a
:=
_latin2
'test'
collate
latin2_bin
)
=
_latin2
'TEST'
collate
latin2_general_ci
;
sql/item_func.cc
View file @
5e34724a
...
...
@@ -2163,6 +2163,7 @@ bool Item_func_set_user_var::fix_fields(THD *thd, TABLE_LIST *tables,
is different from query_id).
*/
entry
->
update_query_id
=
thd
->
query_id
;
entry
->
collation
.
set
(
args
[
0
]
->
collation
);
cached_result_type
=
args
[
0
]
->
result_type
();
return
0
;
}
...
...
@@ -2174,6 +2175,7 @@ Item_func_set_user_var::fix_length_and_dec()
maybe_null
=
args
[
0
]
->
maybe_null
;
max_length
=
args
[
0
]
->
max_length
;
decimals
=
args
[
0
]
->
decimals
;
collation
.
set
(
args
[
0
]
->
collation
);
}
...
...
@@ -2488,7 +2490,9 @@ void Item_func_get_user_var::fix_length_and_dec()
if
(
!
(
var_entry
=
get_variable
(
&
thd
->
user_vars
,
name
,
0
)))
null_value
=
1
;
else
collation
.
set
(
var_entry
->
collation
);
if
(
!
(
opt_bin_log
&&
is_update_query
(
thd
->
lex
->
sql_command
)))
return
;
...
...
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