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
d504588e
Commit
d504588e
authored
Dec 13, 2007
by
gluh@eagle.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/gluh/MySQL/Merge/5.0-opt
into mysql.com:/home/gluh/MySQL/Merge/5.1-opt
parents
4f586811
9df070ed
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
120 additions
and
25 deletions
+120
-25
mysql-test/include/mix1.inc
mysql-test/include/mix1.inc
+13
-0
mysql-test/r/delayed.result
mysql-test/r/delayed.result
+0
-16
mysql-test/r/func_misc.result
mysql-test/r/func_misc.result
+5
-0
mysql-test/r/innodb_mysql.result
mysql-test/r/innodb_mysql.result
+12
-0
mysql-test/r/range.result
mysql-test/r/range.result
+18
-0
mysql-test/t/func_misc.test
mysql-test/t/func_misc.test
+14
-0
mysql-test/t/range.test
mysql-test/t/range.test
+20
-0
sql/field.cc
sql/field.cc
+3
-0
sql/item.cc
sql/item.cc
+7
-7
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+1
-0
sql/opt_range.cc
sql/opt_range.cc
+26
-1
sql/sql_select.cc
sql/sql_select.cc
+1
-1
No files found.
mysql-test/include/mix1.inc
View file @
d504588e
...
@@ -724,6 +724,19 @@ set @@sort_buffer_size=default;
...
@@ -724,6 +724,19 @@ set @@sort_buffer_size=default;
DROP
TABLE
t1
,
t2
;
DROP
TABLE
t1
,
t2
;
#
#
# Bug #32815: query with ORDER BY and a possible ref_or_null access
#
CREATE
TABLE
t1
(
id
int
,
type
char
(
6
),
d
int
,
INDEX
idx
(
id
,
d
))
ENGINE
=
InnoDB
;
INSERT
INTO
t1
VALUES
(
191
,
'member'
,
1
),
(
NULL
,
'member'
,
3
),
(
NULL
,
'member'
,
4
),
(
201
,
'member'
,
2
);
EXPLAIN
SELECT
*
FROM
t1
WHERE
id
=
191
OR
id
IS
NULL
ORDER
BY
d
;
SELECT
*
FROM
t1
WHERE
id
=
191
OR
id
IS
NULL
ORDER
BY
d
;
DROP
TABLE
t1
;
# Test of behaviour with CREATE ... SELECT
# Test of behaviour with CREATE ... SELECT
#
#
...
...
mysql-test/r/delayed.result
View file @
d504588e
...
@@ -109,20 +109,12 @@ c1
...
@@ -109,20 +109,12 @@ c1
DROP TABLE t1;
DROP TABLE t1;
SET @@auto_increment_offset=
SET @@auto_increment_offset=
@bug20627_old_auto_increment_offset;
@bug20627_old_auto_increment_offset;
Warnings:
Warning 1292 Truncated incorrect auto-increment-offset value: '0'
SET @@auto_increment_increment=
SET @@auto_increment_increment=
@bug20627_old_auto_increment_increment;
@bug20627_old_auto_increment_increment;
Warnings:
Warning 1292 Truncated incorrect auto-increment-increment value: '0'
SET @@session.auto_increment_offset=
SET @@session.auto_increment_offset=
@bug20627_old_session_auto_increment_offset;
@bug20627_old_session_auto_increment_offset;
Warnings:
Warning 1292 Truncated incorrect auto-increment-offset value: '0'
SET @@session.auto_increment_increment=
SET @@session.auto_increment_increment=
@bug20627_old_session_auto_increment_increment;
@bug20627_old_session_auto_increment_increment;
Warnings:
Warning 1292 Truncated incorrect auto-increment-increment value: '0'
SET @bug20830_old_auto_increment_offset=
SET @bug20830_old_auto_increment_offset=
@@auto_increment_offset;
@@auto_increment_offset;
SET @bug20830_old_auto_increment_increment=
SET @bug20830_old_auto_increment_increment=
...
@@ -245,20 +237,12 @@ SUM(c1)
...
@@ -245,20 +237,12 @@ SUM(c1)
DROP TABLE t1;
DROP TABLE t1;
SET @@auto_increment_offset=
SET @@auto_increment_offset=
@bug20830_old_auto_increment_offset;
@bug20830_old_auto_increment_offset;
Warnings:
Warning 1292 Truncated incorrect auto-increment-offset value: '0'
SET @@auto_increment_increment=
SET @@auto_increment_increment=
@bug20830_old_auto_increment_increment;
@bug20830_old_auto_increment_increment;
Warnings:
Warning 1292 Truncated incorrect auto-increment-increment value: '0'
SET @@session.auto_increment_offset=
SET @@session.auto_increment_offset=
@bug20830_old_session_auto_increment_offset;
@bug20830_old_session_auto_increment_offset;
Warnings:
Warning 1292 Truncated incorrect auto-increment-offset value: '0'
SET @@session.auto_increment_increment=
SET @@session.auto_increment_increment=
@bug20830_old_session_auto_increment_increment;
@bug20830_old_session_auto_increment_increment;
Warnings:
Warning 1292 Truncated incorrect auto-increment-increment value: '0'
CREATE TABLE t1(a BIT);
CREATE TABLE t1(a BIT);
INSERT DELAYED INTO t1 VALUES(1);
INSERT DELAYED INTO t1 VALUES(1);
FLUSH TABLE t1;
FLUSH TABLE t1;
...
...
mysql-test/r/func_misc.result
View file @
d504588e
...
@@ -212,6 +212,11 @@ test
...
@@ -212,6 +212,11 @@ test
SELECT NAME_CONST('test', 'test');
SELECT NAME_CONST('test', 'test');
test
test
test
test
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (5), (2);
SELECT NAME_CONST(x,2) FROM (SELECT a x FROM t1) t;
ERROR HY000: Incorrect arguments to NAME_CONST
DROP TABLE t1;
CREATE TABLE t1(a INT);
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (), (), ();
INSERT INTO t1 VALUES (), (), ();
SELECT NAME_CONST(a, '1') FROM t1;
SELECT NAME_CONST(a, '1') FROM t1;
...
...
mysql-test/r/innodb_mysql.result
View file @
d504588e
...
@@ -1344,6 +1344,18 @@ t1 CREATE TABLE `t1` (
...
@@ -1344,6 +1344,18 @@ t1 CREATE TABLE `t1` (
UNIQUE KEY `aa` (`a`(1))
UNIQUE KEY `aa` (`a`(1))
) ENGINE=InnoDB DEFAULT CHARSET=latin1
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t1;
drop table t1;
CREATE TABLE t1 (id int, type char(6), d int, INDEX idx(id,d)) ENGINE=InnoDB;
INSERT INTO t1 VALUES
(191, 'member', 1), (NULL, 'member', 3), (NULL, 'member', 4), (201, 'member', 2);
EXPLAIN SELECT * FROM t1 WHERE id=191 OR id IS NULL ORDER BY d;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL idx NULL NULL NULL 3 Using where; Using filesort
SELECT * FROM t1 WHERE id=191 OR id IS NULL ORDER BY d;
id type d
191 member 1
NULL member 3
NULL member 4
DROP TABLE t1;
End of 5.0 tests
End of 5.0 tests
CREATE TABLE `t2` (
CREATE TABLE `t2` (
`k` int(11) NOT NULL auto_increment,
`k` int(11) NOT NULL auto_increment,
...
...
mysql-test/r/range.result
View file @
d504588e
...
@@ -1149,3 +1149,21 @@ explain select * from t2 where a=1000 and b<11;
...
@@ -1149,3 +1149,21 @@ explain select * from t2 where a=1000 and b<11;
id select_type table type possible_keys key key_len ref rows Extra
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref a a 5 const 502 Using where
1 SIMPLE t2 ref a a 5 const 502 Using where
drop table t1, t2;
drop table t1, t2;
BUG#32198 "Comparison of DATE with DATETIME still not using indexes correctly"
CREATE TABLE t1 (
id int(11) NOT NULL auto_increment,
dateval date default NULL,
PRIMARY KEY (id),
KEY dateval (dateval)
) AUTO_INCREMENT=173;
INSERT INTO t1 VALUES
(1,'2007-01-01'),(2,'2007-01-02'),(3,'2007-01-03'),(4,'2007-01-04'),
(5,'2007-01-05'),(6,'2007-01-06'),(7,'2007-01-07'),(8,'2007-01-08'),
(9,'2007-01-09'),(10,'2007-01-10'),(11,'2007-01-11');
This must use range access:
explain select * from t1 where dateval >= '2007-01-01 00:00:00' and dateval <= '2007-01-02 23:59:59';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range dateval dateval 4 NULL 2 Using where
drop table t1;
mysql-test/t/func_misc.test
View file @
d504588e
...
@@ -213,6 +213,20 @@ SELECT NAME_CONST('test', 1.0);
...
@@ -213,6 +213,20 @@ SELECT NAME_CONST('test', 1.0);
SELECT
NAME_CONST
(
'test'
,
-
1.0
);
SELECT
NAME_CONST
(
'test'
,
-
1.0
);
SELECT
NAME_CONST
(
'test'
,
'test'
);
SELECT
NAME_CONST
(
'test'
,
'test'
);
#
# Bug #27545: erroneous usage of NAME_CONST with a name as the first parameter
# resolved against a column name of a derived table hangs the client
#
CREATE
TABLE
t1
(
a
int
);
INSERT
INTO
t1
VALUES
(
5
),
(
2
);
--
error
ER_WRONG_ARGUMENTS
SELECT
NAME_CONST
(
x
,
2
)
FROM
(
SELECT
a
x
FROM
t1
)
t
;
DROP
TABLE
t1
;
#
#
# Bug #32559: connection hangs on query with name_const
# Bug #32559: connection hangs on query with name_const
#
#
...
...
mysql-test/t/range.test
View file @
d504588e
...
@@ -935,6 +935,26 @@ SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-02 00:00:00';
...
@@ -935,6 +935,26 @@ SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-02 00:00:00';
DROP
TABLE
t1
;
DROP
TABLE
t1
;
--
echo
--
echo
BUG
#32198 "Comparison of DATE with DATETIME still not using indexes correctly"
--
echo
CREATE
TABLE
t1
(
id
int
(
11
)
NOT
NULL
auto_increment
,
dateval
date
default
NULL
,
PRIMARY
KEY
(
id
),
KEY
dateval
(
dateval
)
)
AUTO_INCREMENT
=
173
;
INSERT
INTO
t1
VALUES
(
1
,
'2007-01-01'
),(
2
,
'2007-01-02'
),(
3
,
'2007-01-03'
),(
4
,
'2007-01-04'
),
(
5
,
'2007-01-05'
),(
6
,
'2007-01-06'
),(
7
,
'2007-01-07'
),(
8
,
'2007-01-08'
),
(
9
,
'2007-01-09'
),(
10
,
'2007-01-10'
),(
11
,
'2007-01-11'
);
--
echo
This
must
use
range
access:
explain select * from t1 where dateval >= '2007-01-01 00:00:00' and dateval <= '2007-01-02 23:59:59'
;
drop
table
t1
;
# End of 5.0 tests
# End of 5.0 tests
# BUG#22393 fix: Adjust 'ref' estimate if we have 'range' estimate for
# BUG#22393 fix: Adjust 'ref' estimate if we have 'range' estimate for
...
...
sql/field.cc
View file @
d504588e
...
@@ -5701,6 +5701,9 @@ void Field_date::sql_type(String &res) const
...
@@ -5701,6 +5701,9 @@ void Field_date::sql_type(String &res) const
1 Value was cut during conversion
1 Value was cut during conversion
2 Wrong date string
2 Wrong date string
3 Datetime value that was cut (warning level NOTE)
3 Datetime value that was cut (warning level NOTE)
This is used by opt_range.cc:get_mm_leaf(). Note that there is a
nearly-identical class Field_date doesn't ever return 3 from its
store function.
*/
*/
int
Field_newdate
::
store
(
const
char
*
from
,
uint
len
,
CHARSET_INFO
*
cs
)
int
Field_newdate
::
store
(
const
char
*
from
,
uint
len
,
CHARSET_INFO
*
cs
)
...
...
sql/item.cc
View file @
d504588e
...
@@ -1262,14 +1262,14 @@ bool Item_name_const::fix_fields(THD *thd, Item **ref)
...
@@ -1262,14 +1262,14 @@ bool Item_name_const::fix_fields(THD *thd, Item **ref)
s
.
length
(
0
);
s
.
length
(
0
);
if
(
value_item
->
fix_fields
(
thd
,
&
value_item
)
||
if
(
value_item
->
fix_fields
(
thd
,
&
value_item
)
||
name_item
->
fix_fields
(
thd
,
&
name_item
))
name_item
->
fix_fields
(
thd
,
&
name_item
)
||
return
TRUE
;
!
value_item
->
const_item
()
||
if
(
!
(
value_item
->
const_item
()
&&
name_item
->
const_item
()))
!
name_item
->
const_item
()
||
!
(
item_name
=
name_item
->
val_str
(
&
s
)))
// Can't have a NULL name
{
my_error
(
ER_RESERVED_SYNTAX
,
MYF
(
0
),
"NAME_CONST"
);
return
TRUE
;
return
TRUE
;
}
if
(
!
(
item_name
=
name_item
->
val_str
(
&
s
)))
return
TRUE
;
/* Can't have a NULL name */
set_name
(
item_name
->
ptr
(),
(
uint
)
item_name
->
length
(),
system_charset_info
);
set_name
(
item_name
->
ptr
(),
(
uint
)
item_name
->
length
(),
system_charset_info
);
max_length
=
value_item
->
max_length
;
max_length
=
value_item
->
max_length
;
decimals
=
value_item
->
decimals
;
decimals
=
value_item
->
decimals
;
...
...
sql/item_cmpfunc.cc
View file @
d504588e
...
@@ -392,6 +392,7 @@ static bool convert_constant_item(THD *thd, Item_field *field_item,
...
@@ -392,6 +392,7 @@ static bool convert_constant_item(THD *thd, Item_field *field_item,
LINT_INIT
(
old_write_map
);
LINT_INIT
(
old_write_map
);
LINT_INIT
(
old_read_map
);
LINT_INIT
(
old_read_map
);
LINT_INIT
(
orig_field_val
);
if
(
table
)
if
(
table
)
{
{
...
...
sql/opt_range.cc
View file @
d504588e
...
@@ -5735,6 +5735,7 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field,
...
@@ -5735,6 +5735,7 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field,
{
{
tree
=
new
(
alloc
)
SEL_ARG
(
field
,
0
,
0
);
tree
=
new
(
alloc
)
SEL_ARG
(
field
,
0
,
0
);
tree
->
type
=
SEL_ARG
::
IMPOSSIBLE
;
tree
->
type
=
SEL_ARG
::
IMPOSSIBLE
;
goto
end
;
}
}
else
else
{
{
...
@@ -5743,9 +5744,33 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field,
...
@@ -5743,9 +5744,33 @@ get_mm_leaf(RANGE_OPT_PARAM *param, COND *conf_func, Field *field,
for the cases like int_field > 999999999999999999999999 as well.
for the cases like int_field > 999999999999999999999999 as well.
*/
*/
tree
=
0
;
tree
=
0
;
if
(
err
==
3
&&
field
->
type
()
==
FIELD_TYPE_DATE
&&
(
type
==
Item_func
::
GT_FUNC
||
type
==
Item_func
::
GE_FUNC
||
type
==
Item_func
::
LT_FUNC
||
type
==
Item_func
::
LE_FUNC
)
)
{
/*
We were saving DATETIME into a DATE column, the conversion went ok
but a non-zero time part was cut off.
In MySQL's SQL dialect, DATE and DATETIME are compared as datetime
values. Index over a DATE column uses DATE comparison. Changing
from one comparison to the other is possible:
datetime(date_col)< '2007-12-10 12:34:55' -> date_col<='2007-12-10'
datetime(date_col)<='2007-12-10 12:34:55' -> date_col<='2007-12-10'
datetime(date_col)> '2007-12-10 12:34:55' -> date_col>='2007-12-10'
datetime(date_col)>='2007-12-10 12:34:55' -> date_col>='2007-12-10'
but we'll need to convert '>' to '>=' and '<' to '<='. This will
be done together with other types at the end of this function
(grep for field_is_equal_to_item)
*/
}
}
else
goto
end
;
goto
end
;
}
}
}
if
(
err
<
0
)
if
(
err
<
0
)
{
{
field
->
table
->
in_use
->
variables
.
sql_mode
=
orig_sql_mode
;
field
->
table
->
in_use
->
variables
.
sql_mode
=
orig_sql_mode
;
...
...
sql/sql_select.cc
View file @
d504588e
...
@@ -3739,7 +3739,7 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
...
@@ -3739,7 +3739,7 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
found_eq_constant
=
0
;
found_eq_constant
=
0
;
for
(
i
=
0
;
i
<
keyuse
->
elements
-
1
;
i
++
,
use
++
)
for
(
i
=
0
;
i
<
keyuse
->
elements
-
1
;
i
++
,
use
++
)
{
{
if
(
!
use
->
used_tables
)
if
(
!
use
->
used_tables
&&
use
->
optimize
!=
KEY_OPTIMIZE_REF_OR_NULL
)
use
->
table
->
const_key_parts
[
use
->
key
]
|=
use
->
keypart_map
;
use
->
table
->
const_key_parts
[
use
->
key
]
|=
use
->
keypart_map
;
if
(
use
->
keypart
!=
FT_KEYPART
)
if
(
use
->
keypart
!=
FT_KEYPART
)
{
{
...
...
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