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
5a8fd4a3
Commit
5a8fd4a3
authored
Nov 21, 2008
by
Ramil Kalimullin
Browse files
Options
Browse Files
Download
Plain Diff
Auto-merge
parents
30b795df
ca31fa35
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
5 deletions
+57
-5
mysql-test/r/ctype_utf8.result
mysql-test/r/ctype_utf8.result
+32
-0
mysql-test/t/ctype_utf8.test
mysql-test/t/ctype_utf8.test
+17
-0
sql/item_timefunc.cc
sql/item_timefunc.cc
+8
-5
No files found.
mysql-test/r/ctype_utf8.result
View file @
5a8fd4a3
...
...
@@ -1848,3 +1848,35 @@ select hex(_utf8 B'001111111111');
ERROR HY000: Invalid utf8 character string: 'FF'
select (_utf8 X'616263FF');
ERROR HY000: Invalid utf8 character string: 'FF'
CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL);
INSERT INTO t1 VALUES (70000, 1092), (70001, 1085), (70002, 1065);
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
CONVERT(a, CHAR) CONVERT(b, CHAR)
70002 1065
70001 1085
70000 1092
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1;
CONVERT(a, CHAR) CONVERT(b, CHAR)
70000 1092
70001 1085
70002 1065
ALTER TABLE t1 ADD UNIQUE (b);
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
CONVERT(a, CHAR) CONVERT(b, CHAR)
70002 1065
70001 1085
70000 1092
DROP INDEX b ON t1;
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
CONVERT(a, CHAR) CONVERT(b, CHAR)
70002 1065
70001 1085
70000 1092
ALTER TABLE t1 ADD INDEX (b);
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) from t1 GROUP BY b;
CONVERT(a, CHAR) CONVERT(b, CHAR)
70002 1065
70001 1085
70000 1092
DROP TABLE t1;
End of 5.0 tests
mysql-test/t/ctype_utf8.test
View file @
5a8fd4a3
...
...
@@ -1439,3 +1439,20 @@ select hex(_utf8 X'616263FF');
select
hex
(
_utf8
B
'001111111111'
);
--
error
ER_INVALID_CHARACTER_STRING
select
(
_utf8
X
'616263FF'
);
#
# Bug #36772: When using UTF8, CONVERT with GROUP BY returns truncated results
#
CREATE
TABLE
t1
(
a
INT
NOT
NULL
,
b
INT
NOT
NULL
);
INSERT
INTO
t1
VALUES
(
70000
,
1092
),
(
70001
,
1085
),
(
70002
,
1065
);
SELECT
CONVERT
(
a
,
CHAR
),
CONVERT
(
b
,
CHAR
)
FROM
t1
GROUP
BY
b
;
SELECT
CONVERT
(
a
,
CHAR
),
CONVERT
(
b
,
CHAR
)
FROM
t1
;
ALTER
TABLE
t1
ADD
UNIQUE
(
b
);
SELECT
CONVERT
(
a
,
CHAR
),
CONVERT
(
b
,
CHAR
)
FROM
t1
GROUP
BY
b
;
DROP
INDEX
b
ON
t1
;
SELECT
CONVERT
(
a
,
CHAR
),
CONVERT
(
b
,
CHAR
)
FROM
t1
GROUP
BY
b
;
ALTER
TABLE
t1
ADD
INDEX
(
b
);
SELECT
CONVERT
(
a
,
CHAR
),
CONVERT
(
b
,
CHAR
)
from
t1
GROUP
BY
b
;
DROP
TABLE
t1
;
--
echo
End
of
5.0
tests
sql/item_timefunc.cc
View file @
5a8fd4a3
...
...
@@ -2504,6 +2504,8 @@ void Item_char_typecast::fix_length_and_dec()
and thus avoid unnecessary character set conversion.
- If the argument is not a number, then from_cs is set to
the argument's charset.
Note (TODO): we could use repertoire technique here.
*/
from_cs
=
(
args
[
0
]
->
result_type
()
==
INT_RESULT
||
args
[
0
]
->
result_type
()
==
DECIMAL_RESULT
||
...
...
@@ -2511,12 +2513,13 @@ void Item_char_typecast::fix_length_and_dec()
(
cast_cs
->
mbminlen
==
1
?
cast_cs
:
&
my_charset_latin1
)
:
args
[
0
]
->
collation
.
collation
;
charset_conversion
=
(
cast_cs
->
mbmaxlen
>
1
)
||
!
my_charset_same
(
from_cs
,
cast_cs
)
&&
from_cs
!=
&
my_charset_bin
&&
cast_cs
!=
&
my_charset_bin
;
(
!
my_charset_same
(
from_cs
,
cast_cs
)
&&
from_cs
!=
&
my_charset_bin
&&
cast_cs
!=
&
my_charset_bin
)
;
collation
.
set
(
cast_cs
,
DERIVATION_IMPLICIT
);
char_length
=
(
cast_length
>=
0
)
?
cast_length
:
args
[
0
]
->
max_length
/
from_cs
->
mbmaxlen
;
char_length
=
(
cast_length
>=
0
)
?
cast_length
:
args
[
0
]
->
max_length
/
args
[
0
]
->
collation
.
collation
->
mbmaxlen
;
max_length
=
char_length
*
cast_cs
->
mbmaxlen
;
}
...
...
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