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
b2d0a33e
Commit
b2d0a33e
authored
Apr 06, 2013
by
Igor Babaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug mdev-4373:
Valgrind complained on usage of uninitialized memory.
parent
1ae352af
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
5 deletions
+64
-5
mysql-test/r/selectivity.result
mysql-test/r/selectivity.result
+17
-0
mysql-test/r/selectivity_innodb.result
mysql-test/r/selectivity_innodb.result
+17
-0
mysql-test/t/selectivity.test
mysql-test/t/selectivity.test
+23
-0
sql/field.cc
sql/field.cc
+7
-5
No files found.
mysql-test/r/selectivity.result
View file @
b2d0a33e
...
@@ -850,4 +850,21 @@ set optimizer_switch=@save_optimizer_switch;
...
@@ -850,4 +850,21 @@ set optimizer_switch=@save_optimizer_switch;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
DROP TABLE t1,t2;
DROP TABLE t1,t2;
set use_stat_tables=@save_use_stat_tables;
set use_stat_tables=@save_use_stat_tables;
#
# Bug mdev-4373: condition on a short varchar column
# with optimizer_use_condition_selectivity=3
#
set use_stat_tables=PREFERABLY;
CREATE TABLE t1 (a varchar(1));
INSERT INTO t1 VALUES ('x'), ('y');
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
FLUSH TABLES;
set optimizer_use_condition_selectivity=3;
SELECT * FROM t1 WHERE a <= 'w';
a
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
DROP TABLE t1;
set use_stat_tables=@save_use_stat_tables;
set use_stat_tables=@save_use_stat_tables;
set use_stat_tables=@save_use_stat_tables;
mysql-test/r/selectivity_innodb.result
View file @
b2d0a33e
...
@@ -858,6 +858,23 @@ set optimizer_switch=@save_optimizer_switch;
...
@@ -858,6 +858,23 @@ set optimizer_switch=@save_optimizer_switch;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
DROP TABLE t1,t2;
DROP TABLE t1,t2;
set use_stat_tables=@save_use_stat_tables;
set use_stat_tables=@save_use_stat_tables;
#
# Bug mdev-4373: condition on a short varchar column
# with optimizer_use_condition_selectivity=3
#
set use_stat_tables=PREFERABLY;
CREATE TABLE t1 (a varchar(1));
INSERT INTO t1 VALUES ('x'), ('y');
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
FLUSH TABLES;
set optimizer_use_condition_selectivity=3;
SELECT * FROM t1 WHERE a <= 'w';
a
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
DROP TABLE t1;
set use_stat_tables=@save_use_stat_tables;
set use_stat_tables=@save_use_stat_tables;
set use_stat_tables=@save_use_stat_tables;
set optimizer_switch=@save_optimizer_switch_for_selectivity_test;
set optimizer_switch=@save_optimizer_switch_for_selectivity_test;
SET SESSION STORAGE_ENGINE=DEFAULT;
SET SESSION STORAGE_ENGINE=DEFAULT;
mysql-test/t/selectivity.test
View file @
b2d0a33e
...
@@ -444,5 +444,28 @@ DROP TABLE t1,t2;
...
@@ -444,5 +444,28 @@ DROP TABLE t1,t2;
set
use_stat_tables
=@
save_use_stat_tables
;
set
use_stat_tables
=@
save_use_stat_tables
;
--
echo
#
--
echo
# Bug mdev-4373: condition on a short varchar column
--
echo
# with optimizer_use_condition_selectivity=3
--
echo
#
set
use_stat_tables
=
PREFERABLY
;
CREATE
TABLE
t1
(
a
varchar
(
1
));
INSERT
INTO
t1
VALUES
(
'x'
),
(
'y'
);
ANALYZE
TABLE
t1
;
FLUSH
TABLES
;
set
optimizer_use_condition_selectivity
=
3
;
SELECT
*
FROM
t1
WHERE
a
<=
'w'
;
set
optimizer_use_condition_selectivity
=@
save_optimizer_use_condition_selectivity
;
DROP
TABLE
t1
;
set
use_stat_tables
=@
save_use_stat_tables
;
set
use_stat_tables
=@
save_use_stat_tables
;
set
use_stat_tables
=@
save_use_stat_tables
;
sql/field.cc
View file @
b2d0a33e
...
@@ -6202,14 +6202,16 @@ double Field_str::middle_point_pos(Field *min, Field *max)
...
@@ -6202,14 +6202,16 @@ double Field_str::middle_point_pos(Field *min, Field *max)
uchar
minp_prefix
[
sizeof
(
ulonglong
)];
uchar
minp_prefix
[
sizeof
(
ulonglong
)];
uchar
maxp_prefix
[
sizeof
(
ulonglong
)];
uchar
maxp_prefix
[
sizeof
(
ulonglong
)];
ulonglong
mp
,
minp
,
maxp
;
ulonglong
mp
,
minp
,
maxp
;
uint
dsz
=
min
(
field_length
,
sizeof
(
ulonglong
)
*
charset
()
->
mbmaxlen
);
memset
(
mp_prefix
,
0
,
sizeof
(
ulonglong
));
memset
(
minp_prefix
,
0
,
sizeof
(
ulonglong
));
memset
(
maxp_prefix
,
0
,
sizeof
(
ulonglong
));
my_strnxfrm
(
charset
(),
mp_prefix
,
sizeof
(
mp
),
my_strnxfrm
(
charset
(),
mp_prefix
,
sizeof
(
mp
),
ptr
+
length_size
(),
sizeof
(
mp
)
*
charset
()
->
mbmaxlen
);
ptr
+
length_size
(),
dsz
);
my_strnxfrm
(
charset
(),
minp_prefix
,
sizeof
(
minp
),
my_strnxfrm
(
charset
(),
minp_prefix
,
sizeof
(
minp
),
min
->
ptr
+
length_size
(),
min
->
ptr
+
length_size
(),
dsz
);
sizeof
(
minp
)
*
charset
()
->
mbmaxlen
);
my_strnxfrm
(
charset
(),
maxp_prefix
,
sizeof
(
maxp
),
my_strnxfrm
(
charset
(),
maxp_prefix
,
sizeof
(
maxp
),
max
->
ptr
+
length_size
(),
max
->
ptr
+
length_size
(),
dsz
);
sizeof
(
maxp
)
*
charset
()
->
mbmaxlen
);
mp
=
char_prefix_to_ulonglong
(
mp_prefix
);
mp
=
char_prefix_to_ulonglong
(
mp_prefix
);
minp
=
char_prefix_to_ulonglong
(
minp_prefix
);
minp
=
char_prefix_to_ulonglong
(
minp_prefix
);
maxp
=
char_prefix_to_ulonglong
(
maxp_prefix
);
maxp
=
char_prefix_to_ulonglong
(
maxp_prefix
);
...
...
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