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
bdab5b66
Commit
bdab5b66
authored
May 22, 2020
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/10.1' into 10.2
parents
450a5b33
cb9c49a9
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
284 additions
and
59 deletions
+284
-59
mysql-test/r/ctype_binary.result
mysql-test/r/ctype_binary.result
+93
-0
mysql-test/t/ctype_binary.test
mysql-test/t/ctype_binary.test
+60
-0
sql/table.cc
sql/table.cc
+116
-51
sql/unireg.cc
sql/unireg.cc
+15
-8
No files found.
mysql-test/r/ctype_binary.result
View file @
bdab5b66
...
...
@@ -3172,5 +3172,98 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' and weight_string(`test`.`t1`.`a`,0,0,1) = 'a'
DROP TABLE t1;
#
# MDEV-22111 ERROR 1064 & 1033 and SIGSEGV on CREATE TABLE w/ various charsets on 10.4/5 optimized builds | Assertion `(uint) (table_check_constraints - share->check_constraints) == (uint) (share->table_check_constraints - share->field_check_constraints)' failed
#
CREATE TABLE t1(a ENUM(0x6100,0x6200,0x6300) CHARACTER SET 'Binary');
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` enum('a\0','b\0','c\0') CHARACTER SET binary DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (1),(2),(3);
SELECT HEX(a) FROM t1 ORDER BY a;
HEX(a)
6100
6200
6300
DROP TABLE t1;
0x00 in the middle or in the end of a value
CREATE TABLE t1 (a ENUM(0x6100));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` enum('a\0') DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (1);
SELECT HEX(a) FROM t1;
HEX(a)
6100
DROP TABLE t1;
CREATE TABLE t1 (a ENUM(0x610062));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` enum('a\0b') DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (1);
SELECT HEX(a) FROM t1;
HEX(a)
610062
DROP TABLE t1;
0x00 in the beginning of the first value:
CREATE TABLE t1 (a ENUM(0x0061));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` enum('\0a') DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES(1);
SELECT HEX(a) FROM t1;
HEX(a)
0061
DROP TABLE t1;
CREATE TABLE t1 (a ENUM(0x0061), b ENUM('b'));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` enum('\0a') DEFAULT NULL,
`b` enum('b') DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (1,1);
SELECT HEX(a), HEX(b) FROM t1;
HEX(a) HEX(b)
0061 62
DROP TABLE t1;
# 0x00 in the beginning of the second (and following) value of the *last* ENUM/SET in the table:
CREATE TABLE t1 (a ENUM('a',0x0061));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` enum('a','\0a') DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (1),(2);
SELECT HEX(a) FROM t1 ORDER BY a;
HEX(a)
61
0061
DROP TABLE t1;
CREATE TABLE t1 (a ENUM('a'), b ENUM('b',0x0061));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` enum('a') DEFAULT NULL,
`b` enum('b','\0a') DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (1,1);
INSERT INTO t1 VALUES (1,2);
SELECT HEX(a), HEX(b) FROM t1 ORDER BY a, b;
HEX(a) HEX(b)
61 62
61 0061
DROP TABLE t1;
0x00 in the beginning of a value of a non-last ENUM/SET causes an error:
CREATE TABLE t1 (a ENUM('a',0x0061), b ENUM('b'));
ERROR HY000: Incorrect information in file: 'DIR/t1.frm'
#
# End of 10.1 tests
#
mysql-test/t/ctype_binary.test
View file @
bdab5b66
...
...
@@ -74,6 +74,66 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE COERCIBILITY(a)=2 AND a='a';
EXPLAIN
EXTENDED
SELECT
*
FROM
t1
WHERE
WEIGHT_STRING
(
a
)
=
'a'
AND
a
=
'a'
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# MDEV-22111 ERROR 1064 & 1033 and SIGSEGV on CREATE TABLE w/ various charsets on 10.4/5 optimized builds | Assertion `(uint) (table_check_constraints - share->check_constraints) == (uint) (share->table_check_constraints - share->field_check_constraints)' failed
--
echo
#
CREATE
TABLE
t1
(
a
ENUM
(
0x6100
,
0x6200
,
0x6300
)
CHARACTER
SET
'Binary'
);
SHOW
CREATE
TABLE
t1
;
INSERT
INTO
t1
VALUES
(
1
),(
2
),(
3
);
SELECT
HEX
(
a
)
FROM
t1
ORDER
BY
a
;
DROP
TABLE
t1
;
--
echo
0x00
in
the
middle
or
in
the
end
of
a
value
CREATE
TABLE
t1
(
a
ENUM
(
0x6100
));
SHOW
CREATE
TABLE
t1
;
INSERT
INTO
t1
VALUES
(
1
);
SELECT
HEX
(
a
)
FROM
t1
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
a
ENUM
(
0x610062
));
SHOW
CREATE
TABLE
t1
;
INSERT
INTO
t1
VALUES
(
1
);
SELECT
HEX
(
a
)
FROM
t1
;
DROP
TABLE
t1
;
--
echo
0x00
in
the
beginning
of
the
first
value
:
CREATE
TABLE
t1
(
a
ENUM
(
0x0061
));
SHOW
CREATE
TABLE
t1
;
INSERT
INTO
t1
VALUES
(
1
);
SELECT
HEX
(
a
)
FROM
t1
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
a
ENUM
(
0x0061
),
b
ENUM
(
'b'
));
SHOW
CREATE
TABLE
t1
;
INSERT
INTO
t1
VALUES
(
1
,
1
);
SELECT
HEX
(
a
),
HEX
(
b
)
FROM
t1
;
DROP
TABLE
t1
;
--
echo
# 0x00 in the beginning of the second (and following) value of the *last* ENUM/SET in the table:
CREATE
TABLE
t1
(
a
ENUM
(
'a'
,
0x0061
));
SHOW
CREATE
TABLE
t1
;
INSERT
INTO
t1
VALUES
(
1
),(
2
);
SELECT
HEX
(
a
)
FROM
t1
ORDER
BY
a
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
a
ENUM
(
'a'
),
b
ENUM
(
'b'
,
0x0061
));
SHOW
CREATE
TABLE
t1
;
INSERT
INTO
t1
VALUES
(
1
,
1
);
INSERT
INTO
t1
VALUES
(
1
,
2
);
SELECT
HEX
(
a
),
HEX
(
b
)
FROM
t1
ORDER
BY
a
,
b
;
DROP
TABLE
t1
;
--
echo
0x00
in
the
beginning
of
a
value
of
a
non
-
last
ENUM
/
SET
causes
an
error
:
--
replace_regex
/
'.*t1.frm'
/
'DIR\/t1.frm'
/
--
error
ER_NOT_FORM_FILE
CREATE
TABLE
t1
(
a
ENUM
(
'a'
,
0x0061
),
b
ENUM
(
'b'
));
--
echo
#
--
echo
# End of 10.1 tests
--
echo
#
sql/table.cc
View file @
bdab5b66
This diff is collapsed.
Click to expand it.
sql/unireg.cc
View file @
bdab5b66
...
...
@@ -594,6 +594,18 @@ static bool pack_vcols(String *buf, List<Create_field> &create_fields,
}
static
uint
typelib_values_packed_length
(
const
TYPELIB
*
t
)
{
uint
length
=
0
;
for
(
uint
i
=
0
;
t
->
type_names
[
i
];
i
++
)
{
length
+=
t
->
type_lengths
[
i
];
length
++
;
/* Separator */
}
return
length
;
}
/* Make formheader */
static
bool
pack_header
(
THD
*
thd
,
uchar
*
forminfo
,
...
...
@@ -686,9 +698,8 @@ static bool pack_header(THD *thd, uchar *forminfo,
field
->
interval_id
=
get_interval_id
(
&
int_count
,
create_fields
,
field
);
if
(
old_int_count
!=
int_count
)
{
for
(
const
char
**
pos
=
field
->
interval
->
type_names
;
*
pos
;
pos
++
)
int_length
+=
(
uint
)
strlen
(
*
pos
)
+
1
;
// field + suffix prefix
int_parts
+=
field
->
interval
->
count
+
1
;
int_length
+=
typelib_values_packed_length
(
field
->
interval
);
int_parts
+=
field
->
interval
->
count
+
1
;
}
}
if
(
f_maybe_null
(
field
->
pack_flag
))
...
...
@@ -777,11 +788,7 @@ static size_t packed_fields_length(List<Create_field> &create_fields)
{
int_count
=
field
->
interval_id
;
length
++
;
for
(
int
i
=
0
;
field
->
interval
->
type_names
[
i
];
i
++
)
{
length
+=
field
->
interval
->
type_lengths
[
i
];
length
++
;
}
length
+=
typelib_values_packed_length
(
field
->
interval
);
length
++
;
}
...
...
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