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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
8dad7dfa
Commit
8dad7dfa
authored
Mar 10, 2013
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Plain Diff
5.3->5.5 merge
parents
9d8ee74b
926b0f54
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
128 additions
and
4 deletions
+128
-4
mysql-test/r/select.result
mysql-test/r/select.result
+20
-0
mysql-test/r/select_jcl6.result
mysql-test/r/select_jcl6.result
+20
-0
mysql-test/r/select_pkeycache.result
mysql-test/r/select_pkeycache.result
+20
-0
mysql-test/r/type_enum.result
mysql-test/r/type_enum.result
+15
-0
mysql-test/t/select.test
mysql-test/t/select.test
+19
-0
mysql-test/t/type_enum.test
mysql-test/t/type_enum.test
+15
-0
sql/field.h
sql/field.h
+1
-0
sql/item_cmpfunc.h
sql/item_cmpfunc.h
+9
-0
sql/sql_join_cache.cc
sql/sql_join_cache.cc
+1
-1
sql/sql_select.cc
sql/sql_select.cc
+5
-2
strings/decimal.c
strings/decimal.c
+3
-1
No files found.
mysql-test/r/select.result
View file @
8dad7dfa
...
...
@@ -5302,4 +5302,24 @@ INSERT INTO t2 VALUES (3),(4);
SELECT * FROM t1, t2 WHERE a=3 AND a=b;
a b
drop table t1,t2;
#
# Bug mdev-4250: wrong transformation of WHERE condition with OR
#
CREATE TABLE t1 (pk int PRIMARY KEY, a int);
INSERT INTO t1 VALUES (3,0), (2,0), (4,1), (5,0), (1,0);
SELECT * FROM t1 WHERE (1=2 OR t1.pk=2) AND t1.a <> 0;
pk a
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE (1=2 OR t1.pk=2) AND t1.a <> 0;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
Note 1003 select 2 AS `pk`,0 AS `a` from `test`.`t1` where ((0 <> 0))
DROP TABLE t1;
SELECT * FROM mysql.time_zone
WHERE ( NOT (Use_leap_seconds <= Use_leap_seconds AND Time_zone_id != 1)
AND Time_zone_id = Time_zone_id
OR Time_zone_id <> Time_zone_id )
AND Use_leap_seconds <> 'N';
Time_zone_id Use_leap_seconds
End of 5.3 tests
mysql-test/r/select_jcl6.result
View file @
8dad7dfa
...
...
@@ -5313,6 +5313,26 @@ INSERT INTO t2 VALUES (3),(4);
SELECT * FROM t1, t2 WHERE a=3 AND a=b;
a b
drop table t1,t2;
#
# Bug mdev-4250: wrong transformation of WHERE condition with OR
#
CREATE TABLE t1 (pk int PRIMARY KEY, a int);
INSERT INTO t1 VALUES (3,0), (2,0), (4,1), (5,0), (1,0);
SELECT * FROM t1 WHERE (1=2 OR t1.pk=2) AND t1.a <> 0;
pk a
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE (1=2 OR t1.pk=2) AND t1.a <> 0;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
Note 1003 select 2 AS `pk`,0 AS `a` from `test`.`t1` where ((0 <> 0))
DROP TABLE t1;
SELECT * FROM mysql.time_zone
WHERE ( NOT (Use_leap_seconds <= Use_leap_seconds AND Time_zone_id != 1)
AND Time_zone_id = Time_zone_id
OR Time_zone_id <> Time_zone_id )
AND Use_leap_seconds <> 'N';
Time_zone_id Use_leap_seconds
End of 5.3 tests
set join_cache_level=default;
show variables like 'join_cache_level';
...
...
mysql-test/r/select_pkeycache.result
View file @
8dad7dfa
...
...
@@ -5302,4 +5302,24 @@ INSERT INTO t2 VALUES (3),(4);
SELECT * FROM t1, t2 WHERE a=3 AND a=b;
a b
drop table t1,t2;
#
# Bug mdev-4250: wrong transformation of WHERE condition with OR
#
CREATE TABLE t1 (pk int PRIMARY KEY, a int);
INSERT INTO t1 VALUES (3,0), (2,0), (4,1), (5,0), (1,0);
SELECT * FROM t1 WHERE (1=2 OR t1.pk=2) AND t1.a <> 0;
pk a
EXPLAIN EXTENDED
SELECT * FROM t1 WHERE (1=2 OR t1.pk=2) AND t1.a <> 0;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
Note 1003 select 2 AS `pk`,0 AS `a` from `test`.`t1` where ((0 <> 0))
DROP TABLE t1;
SELECT * FROM mysql.time_zone
WHERE ( NOT (Use_leap_seconds <= Use_leap_seconds AND Time_zone_id != 1)
AND Time_zone_id = Time_zone_id
OR Time_zone_id <> Time_zone_id )
AND Use_leap_seconds <> 'N';
Time_zone_id Use_leap_seconds
End of 5.3 tests
mysql-test/r/type_enum.result
View file @
8dad7dfa
...
...
@@ -1854,3 +1854,18 @@ a
DROP TABLE t1;
End of 5.1 tests
#
# MDEV-4241: Assertion failure: scale >= 0 && precision > 0 &&
# scale <= precision in decimal_bin_size
#
CREATE TABLE t1 (
f1 enum('1','2','3','4','5')
) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1),(2);
SELECT AVG(f1) FROM t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def AVG(f1) 246 7 6 Y 32896 4 63
AVG(f1)
1.5000
drop table t1;
End of 5.3 tests
...
...
mysql-test/t/select.test
View file @
8dad7dfa
...
...
@@ -4460,5 +4460,24 @@ INSERT INTO t2 VALUES (3),(4);
SELECT
*
FROM
t1
,
t2
WHERE
a
=
3
AND
a
=
b
;
drop
table
t1
,
t2
;
--
echo
#
--
echo
# Bug mdev-4250: wrong transformation of WHERE condition with OR
--
echo
#
CREATE
TABLE
t1
(
pk
int
PRIMARY
KEY
,
a
int
);
INSERT
INTO
t1
VALUES
(
3
,
0
),
(
2
,
0
),
(
4
,
1
),
(
5
,
0
),
(
1
,
0
);
SELECT
*
FROM
t1
WHERE
(
1
=
2
OR
t1
.
pk
=
2
)
AND
t1
.
a
<>
0
;
EXPLAIN
EXTENDED
SELECT
*
FROM
t1
WHERE
(
1
=
2
OR
t1
.
pk
=
2
)
AND
t1
.
a
<>
0
;
DROP
TABLE
t1
;
SELECT
*
FROM
mysql
.
time_zone
WHERE
(
NOT
(
Use_leap_seconds
<=
Use_leap_seconds
AND
Time_zone_id
!=
1
)
AND
Time_zone_id
=
Time_zone_id
OR
Time_zone_id
<>
Time_zone_id
)
AND
Use_leap_seconds
<>
'N'
;
--
echo
End
of
5.3
tests
mysql-test/t/type_enum.test
View file @
8dad7dfa
...
...
@@ -221,3 +221,18 @@ SELECT a FROM t1 WHERE a=0;
DROP TABLE t1;
--echo End of 5.1 tests
--echo #
--echo # MDEV-4241: Assertion failure: scale >= 0 && precision > 0 &&
--echo # scale <= precision in decimal_bin_size
--echo #
CREATE TABLE t1 (
f1 enum('
1
','
2
','
3
','
4
','
5
'
)
)
ENGINE
=
MyISAM
;
INSERT
INTO
t1
VALUES
(
1
),(
2
);
--
enable_metadata
SELECT
AVG
(
f1
)
FROM
t1
;
--
disable_metadata
drop
table
t1
;
--
echo
End
of
5.3
tests
...
...
sql/field.h
View file @
8dad7dfa
...
...
@@ -1999,6 +1999,7 @@ public:
bool
has_charset
(
void
)
const
{
return
TRUE
;
}
/* enum and set are sorted as integers */
CHARSET_INFO
*
sort_charset
(
void
)
const
{
return
&
my_charset_bin
;
}
uint
decimals
()
const
{
return
0
;
}
virtual
uchar
*
pack
(
uchar
*
to
,
const
uchar
*
from
,
uint
max_length
);
virtual
const
uchar
*
unpack
(
uchar
*
to
,
const
uchar
*
from
,
...
...
sql/item_cmpfunc.h
View file @
8dad7dfa
...
...
@@ -1791,6 +1791,15 @@ public:
{
upper_levels
=
0
;
}
void
copy
(
COND_EQUAL
&
cond_equal
)
{
max_members
=
cond_equal
.
max_members
;
upper_levels
=
cond_equal
.
upper_levels
;
if
(
cond_equal
.
current_level
.
is_empty
())
current_level
.
empty
();
else
current_level
=
cond_equal
.
current_level
;
}
};
...
...
sql/sql_join_cache.cc
View file @
8dad7dfa
...
...
@@ -775,7 +775,7 @@ ulong JOIN_CACHE::get_min_join_buffer_size()
tab
=
next_linear_tab
(
join
,
tab
,
WITHOUT_BUSH_ROOTS
))
{
len
+=
tab
->
get_max_used_fieldlength
();
len_last
=+
tab
->
get_used_fieldlength
();
len_last
+=
tab
->
get_used_fieldlength
();
}
size_t
len_addon
=
get_record_max_affix_length
()
+
get_max_key_addon_space_per_record
();
...
...
sql/sql_select.cc
View file @
8dad7dfa
...
...
@@ -11659,7 +11659,9 @@ static COND *build_equal_items_for_cond(THD *thd, COND *cond,
item_equal
->
n_field_items
());
}
((
Item_cond_and
*
)
cond
)
->
cond_equal
=
cond_equal
;
((
Item_cond_and
*
)
cond
)
->
cond_equal
.
copy
(
cond_equal
);
cond_equal
.
current_level
=
((
Item_cond_and
*
)
cond
)
->
cond_equal
.
current_level
;
inherited
=
&
(((
Item_cond_and
*
)
cond
)
->
cond_equal
);
}
/*
...
...
@@ -11737,7 +11739,8 @@ static COND *build_equal_items_for_cond(THD *thd, COND *cond,
set_if_bigger
(
thd
->
lex
->
current_select
->
max_equal_elems
,
item_equal
->
n_field_items
());
}
and_cond
->
cond_equal
=
cond_equal
;
and_cond
->
cond_equal
.
copy
(
cond_equal
);
cond_equal
.
current_level
=
and_cond
->
cond_equal
.
current_level
;
args
->
concat
((
List
<
Item
>
*
)
&
cond_equal
.
current_level
);
return
and_cond
;
...
...
strings/decimal.c
View file @
8dad7dfa
...
...
@@ -1445,7 +1445,9 @@ int decimal_bin_size(int precision, int scale)
intg0
=
intg
/
DIG_PER_DEC1
,
frac0
=
scale
/
DIG_PER_DEC1
,
intg0x
=
intg
-
intg0
*
DIG_PER_DEC1
,
frac0x
=
scale
-
frac0
*
DIG_PER_DEC1
;
DBUG_ASSERT
(
scale
>=
0
&&
precision
>
0
&&
scale
<=
precision
);
DBUG_ASSERT
(
scale
>=
0
);
DBUG_ASSERT
(
precision
>
0
);
DBUG_ASSERT
(
scale
<=
precision
);
return
intg0
*
sizeof
(
dec1
)
+
dig2bytes
[
intg0x
]
+
frac0
*
sizeof
(
dec1
)
+
dig2bytes
[
frac0x
];
}
...
...
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