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
55790f74
Commit
55790f74
authored
Nov 03, 2005
by
evgen@moonbone.local
Browse files
Options
Browse Files
Download
Plain Diff
Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0
into moonbone.local:/work/14093-bug-5.0-mysql
parents
d028e8e0
30fdafea
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
72 additions
and
1 deletion
+72
-1
mysql-test/r/select.result
mysql-test/r/select.result
+40
-0
mysql-test/t/select.test
mysql-test/t/select.test
+18
-0
sql/item.h
sql/item.h
+1
-0
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+5
-0
sql/opt_range.cc
sql/opt_range.cc
+8
-1
No files found.
mysql-test/r/select.result
View file @
55790f74
...
@@ -3201,3 +3201,43 @@ a b c
...
@@ -3201,3 +3201,43 @@ a b c
select * from t1 join t2 straight_join t3 on (t1.a=t3.c);
select * from t1 join t2 straight_join t3 on (t1.a=t3.c);
a b c
a b c
drop table t1, t2 ,t3;
drop table t1, t2 ,t3;
create table t1(f1 int, f2 date);
insert into t1 values(1,'2005-01-01'),(2,'2005-09-01'),(3,'2005-09-30'),
(4,'2005-10-01'),(5,'2005-12-30');
select * from t1 where f2 >= 0;
f1 f2
1 2005-01-01
2 2005-09-01
3 2005-09-30
4 2005-10-01
5 2005-12-30
select * from t1 where f2 >= '0000-00-00';
f1 f2
1 2005-01-01
2 2005-09-01
3 2005-09-30
4 2005-10-01
5 2005-12-30
select * from t1 where f2 >= '2005-09-31';
f1 f2
4 2005-10-01
5 2005-12-30
select * from t1 where f2 >= '2005-09-3a';
f1 f2
4 2005-10-01
5 2005-12-30
Warnings:
Warning 1292 Incorrect date value: '2005-09-3a' for column 'f2' at row 1
select * from t1 where f2 <= '2005-09-31';
f1 f2
1 2005-01-01
2 2005-09-01
3 2005-09-30
select * from t1 where f2 <= '2005-09-3a';
f1 f2
1 2005-01-01
2 2005-09-01
3 2005-09-30
Warnings:
Warning 1292 Incorrect date value: '2005-09-3a' for column 'f2' at row 1
drop table t1;
mysql-test/t/select.test
View file @
55790f74
...
@@ -2711,3 +2711,21 @@ select * from t1 join t2 left join t3 on (t1.a=t3.c);
...
@@ -2711,3 +2711,21 @@ select * from t1 join t2 left join t3 on (t1.a=t3.c);
select
*
from
t1
join
t2
right
join
t3
on
(
t1
.
a
=
t3
.
c
);
select
*
from
t1
join
t2
right
join
t3
on
(
t1
.
a
=
t3
.
c
);
select
*
from
t1
join
t2
straight_join
t3
on
(
t1
.
a
=
t3
.
c
);
select
*
from
t1
join
t2
straight_join
t3
on
(
t1
.
a
=
t3
.
c
);
drop
table
t1
,
t2
,
t3
;
drop
table
t1
,
t2
,
t3
;
#
# Bug #14093 Query takes a lot of time when date format is not valid
# fix optimizes execution. so here we just check that returned set is
# correct.
create
table
t1
(
f1
int
,
f2
date
);
insert
into
t1
values
(
1
,
'2005-01-01'
),(
2
,
'2005-09-01'
),(
3
,
'2005-09-30'
),
(
4
,
'2005-10-01'
),(
5
,
'2005-12-30'
);
# should return all records
select
*
from
t1
where
f2
>=
0
;
select
*
from
t1
where
f2
>=
'0000-00-00'
;
# should return 4,5
select
*
from
t1
where
f2
>=
'2005-09-31'
;
select
*
from
t1
where
f2
>=
'2005-09-3a'
;
# should return 1,2,3
select
*
from
t1
where
f2
<=
'2005-09-31'
;
select
*
from
t1
where
f2
<=
'2005-09-3a'
;
drop
table
t1
;
sql/item.h
View file @
55790f74
...
@@ -1750,6 +1750,7 @@ public:
...
@@ -1750,6 +1750,7 @@ public:
return
ref
->
save_in_field
(
field
,
no_conversions
);
return
ref
->
save_in_field
(
field
,
no_conversions
);
}
}
Item
*
new_item
();
Item
*
new_item
();
virtual
Item
*
real_item
()
{
return
ref
;
}
};
};
...
...
sql/item_cmpfunc.cc
View file @
55790f74
...
@@ -186,13 +186,18 @@ static bool convert_constant_item(THD *thd, Field *field, Item **item)
...
@@ -186,13 +186,18 @@ static bool convert_constant_item(THD *thd, Field *field, Item **item)
{
{
if
((
*
item
)
->
const_item
())
if
((
*
item
)
->
const_item
())
{
{
/* For comparison purposes allow invalid dates like 2000-01-32 */
ulong
orig_sql_mode
=
field
->
table
->
in_use
->
variables
.
sql_mode
;
field
->
table
->
in_use
->
variables
.
sql_mode
|=
MODE_INVALID_DATES
;
if
(
!
(
*
item
)
->
save_in_field
(
field
,
1
)
&&
!
((
*
item
)
->
null_value
))
if
(
!
(
*
item
)
->
save_in_field
(
field
,
1
)
&&
!
((
*
item
)
->
null_value
))
{
{
Item
*
tmp
=
new
Item_int_with_ref
(
field
->
val_int
(),
*
item
);
Item
*
tmp
=
new
Item_int_with_ref
(
field
->
val_int
(),
*
item
);
field
->
table
->
in_use
->
variables
.
sql_mode
=
orig_sql_mode
;
if
(
tmp
)
if
(
tmp
)
thd
->
change_item_tree
(
item
,
tmp
);
thd
->
change_item_tree
(
item
,
tmp
);
return
1
;
// Item was replaced
return
1
;
// Item was replaced
}
}
field
->
table
->
in_use
->
variables
.
sql_mode
=
orig_sql_mode
;
}
}
return
0
;
return
0
;
}
}
...
...
sql/opt_range.cc
View file @
55790f74
...
@@ -3921,13 +3921,20 @@ get_mm_leaf(PARAM *param, COND *conf_func, Field *field, KEY_PART *key_part,
...
@@ -3921,13 +3921,20 @@ get_mm_leaf(PARAM *param, COND *conf_func, Field *field, KEY_PART *key_part,
value
->
result_type
()
!=
STRING_RESULT
&&
value
->
result_type
()
!=
STRING_RESULT
&&
field
->
cmp_type
()
!=
value
->
result_type
())
field
->
cmp_type
()
!=
value
->
result_type
())
goto
end
;
goto
end
;
/* For comparison purposes allow invalid dates like 2000-01-32 */
ulong
orig_sql_mode
=
field
->
table
->
in_use
->
variables
.
sql_mode
;
if
(
value
->
real_item
()
->
type
()
==
Item
::
STRING_ITEM
&&
(
field
->
type
()
==
FIELD_TYPE_DATE
||
field
->
type
()
==
FIELD_TYPE_DATETIME
))
field
->
table
->
in_use
->
variables
.
sql_mode
|=
MODE_INVALID_DATES
;
if
(
value
->
save_in_field_no_warnings
(
field
,
1
)
<
0
)
if
(
value
->
save_in_field_no_warnings
(
field
,
1
)
<
0
)
{
{
field
->
table
->
in_use
->
variables
.
sql_mode
=
orig_sql_mode
;
/* This happens when we try to insert a NULL field in a not null column */
/* This happens when we try to insert a NULL field in a not null column */
tree
=
&
null_element
;
// cmp with NULL is never TRUE
tree
=
&
null_element
;
// cmp with NULL is never TRUE
goto
end
;
goto
end
;
}
}
field
->
table
->
in_use
->
variables
.
sql_mode
=
orig_sql_mode
;
str
=
(
char
*
)
alloc_root
(
alloc
,
key_part
->
store_length
+
1
);
str
=
(
char
*
)
alloc_root
(
alloc
,
key_part
->
store_length
+
1
);
if
(
!
str
)
if
(
!
str
)
goto
end
;
goto
end
;
...
...
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