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
33721d91
Commit
33721d91
authored
May 10, 2018
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-16134 Wrong I_S.COLUMNS.CHARACTER_XXX_LENGTH value for compressed columns
parent
fc63c1e1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
1 deletion
+37
-1
mysql-test/main/column_compression.result
mysql-test/main/column_compression.result
+16
-0
mysql-test/main/column_compression.test
mysql-test/main/column_compression.test
+16
-0
sql/field.h
sql/field.h
+5
-1
No files found.
mysql-test/main/column_compression.result
View file @
33721d91
...
@@ -1403,3 +1403,19 @@ SELECT CHAR_LENGTH(a), CHAR_LENGTH(b), LEFT(a, 10), LEFT(b, 10) FROM t1;
...
@@ -1403,3 +1403,19 @@ SELECT CHAR_LENGTH(a), CHAR_LENGTH(b), LEFT(a, 10), LEFT(b, 10) FROM t1;
CHAR_LENGTH(a) CHAR_LENGTH(b) LEFT(a, 10) LEFT(b, 10)
CHAR_LENGTH(a) CHAR_LENGTH(b) LEFT(a, 10) LEFT(b, 10)
254 254 aaaaaaaaaa aaaaaaaaaa
254 254 aaaaaaaaaa aaaaaaaaaa
DROP TABLE t1;
DROP TABLE t1;
#
# MDEV-16134 Wrong I_S.COLUMNS.CHARACTER_XXX_LENGTH value for compressed columns
#
CREATE TABLE t1
(
a VARCHAR(10) CHARACTER SET latin1 COMPRESSED,
b VARCHAR(10) CHARACTER SET utf8 COMPRESSED
);
SELECT COLUMN_NAME, CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1' AND COLUMN_NAME IN ('a','b')
ORDER BY COLUMN_NAME;
COLUMN_NAME CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH
a 10 10
b 10 30
DROP TABLE t1;
mysql-test/main/column_compression.test
View file @
33721d91
...
@@ -120,3 +120,19 @@ CREATE TABLE t1(a TINYTEXT COMPRESSED, b TINYTEXT) CHARACTER SET utf8;
...
@@ -120,3 +120,19 @@ CREATE TABLE t1(a TINYTEXT COMPRESSED, b TINYTEXT) CHARACTER SET utf8;
INSERT
INTO
t1
VALUES
(
REPEAT
(
_latin1
'a'
,
254
),
REPEAT
(
_latin1
'a'
,
254
));
INSERT
INTO
t1
VALUES
(
REPEAT
(
_latin1
'a'
,
254
),
REPEAT
(
_latin1
'a'
,
254
));
SELECT
CHAR_LENGTH
(
a
),
CHAR_LENGTH
(
b
),
LEFT
(
a
,
10
),
LEFT
(
b
,
10
)
FROM
t1
;
SELECT
CHAR_LENGTH
(
a
),
CHAR_LENGTH
(
b
),
LEFT
(
a
,
10
),
LEFT
(
b
,
10
)
FROM
t1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# MDEV-16134 Wrong I_S.COLUMNS.CHARACTER_XXX_LENGTH value for compressed columns
--
echo
#
CREATE
TABLE
t1
(
a
VARCHAR
(
10
)
CHARACTER
SET
latin1
COMPRESSED
,
b
VARCHAR
(
10
)
CHARACTER
SET
utf8
COMPRESSED
);
SELECT
COLUMN_NAME
,
CHARACTER_MAXIMUM_LENGTH
,
CHARACTER_OCTET_LENGTH
FROM
INFORMATION_SCHEMA
.
COLUMNS
WHERE
TABLE_SCHEMA
=
'test'
AND
TABLE_NAME
=
't1'
AND
COLUMN_NAME
IN
(
'a'
,
'b'
)
ORDER
BY
COLUMN_NAME
;
DROP
TABLE
t1
;
sql/field.h
View file @
33721d91
...
@@ -1737,7 +1737,7 @@ class Field_str :public Field {
...
@@ -1737,7 +1737,7 @@ class Field_str :public Field {
Information_schema_character_attributes
Information_schema_character_attributes
information_schema_character_attributes
()
const
information_schema_character_attributes
()
const
{
{
return
Information_schema_character_attributes
(
field_length
,
return
Information_schema_character_attributes
(
max_display_length
()
,
char_length
());
char_length
());
}
}
friend
class
Create_field
;
friend
class
Create_field
;
...
@@ -3448,6 +3448,10 @@ class Field_varstring_compressed: public Field_varstring {
...
@@ -3448,6 +3448,10 @@ class Field_varstring_compressed: public Field_varstring {
str
.
append
(
STRING_WITH_LEN
(
" /*!100301 COMPRESSED*/"
));
str
.
append
(
STRING_WITH_LEN
(
" /*!100301 COMPRESSED*/"
));
}
}
uint32
max_display_length
()
const
{
return
field_length
-
1
;
}
uint32
max_display_length
()
const
{
return
field_length
-
1
;
}
uint32
char_length
()
const
{
return
(
field_length
-
1
)
/
field_charset
->
mbmaxlen
;
}
int
cmp_max
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
,
uint
max_len
);
int
cmp_max
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
,
uint
max_len
);
/*
/*
...
...
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