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
7bb4166a
Commit
7bb4166a
authored
Jul 02, 2003
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug #504: in "datetime op int" comparison int wasn't converted to datetime
parent
49938821
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
3 deletions
+13
-3
mysql-test/r/type_datetime.result
mysql-test/r/type_datetime.result
+8
-1
mysql-test/t/type_datetime.test
mysql-test/t/type_datetime.test
+4
-1
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+1
-1
No files found.
mysql-test/r/type_datetime.result
View file @
7bb4166a
...
@@ -52,10 +52,17 @@ a
...
@@ -52,10 +52,17 @@ a
0000-00-00 00:00:00
0000-00-00 00:00:00
drop table t1;
drop table t1;
create table t1 (id int, dt datetime);
create table t1 (id int, dt datetime);
insert into t1 values (1,"2001-08-14 00:00:00"),(2,"2001-08-15 00:00:00"),(3,"2001-08-16 00:00:00");
insert into t1 values (1,"2001-08-14 00:00:00"),(2,"2001-08-15 00:00:00"),(3,"2001-08-16 00:00:00")
,(4,"2003-09-15 01:20:30")
;
select * from t1 where dt='2001-08-14 00:00:00' and dt = if(id=1,'2001-08-14 00:00:00','1999-08-15');
select * from t1 where dt='2001-08-14 00:00:00' and dt = if(id=1,'2001-08-14 00:00:00','1999-08-15');
id dt
id dt
1 2001-08-14 00:00:00
1 2001-08-14 00:00:00
create index dt on t1 (dt);
select * from t1 where dt > 20021020;
id dt
4 2003-09-15 01:20:30
select * from t1 ignore index (dt) where dt > 20021020;
id dt
4 2003-09-15 01:20:30
drop table t1;
drop table t1;
CREATE TABLE `t1` (
CREATE TABLE `t1` (
`date` datetime NOT NULL default '0000-00-00 00:00:00',
`date` datetime NOT NULL default '0000-00-00 00:00:00',
...
...
mysql-test/t/type_datetime.test
View file @
7bb4166a
...
@@ -36,8 +36,11 @@ drop table t1;
...
@@ -36,8 +36,11 @@ drop table t1;
#
#
create
table
t1
(
id
int
,
dt
datetime
);
create
table
t1
(
id
int
,
dt
datetime
);
insert
into
t1
values
(
1
,
"2001-08-14 00:00:00"
),(
2
,
"2001-08-15 00:00:00"
),(
3
,
"2001-08-16 00:00:00"
);
insert
into
t1
values
(
1
,
"2001-08-14 00:00:00"
),(
2
,
"2001-08-15 00:00:00"
),(
3
,
"2001-08-16 00:00:00"
)
,(
4
,
"2003-09-15 01:20:30"
)
;
select
*
from
t1
where
dt
=
'2001-08-14 00:00:00'
and
dt
=
if
(
id
=
1
,
'2001-08-14 00:00:00'
,
'1999-08-15'
);
select
*
from
t1
where
dt
=
'2001-08-14 00:00:00'
and
dt
=
if
(
id
=
1
,
'2001-08-14 00:00:00'
,
'1999-08-15'
);
create
index
dt
on
t1
(
dt
);
select
*
from
t1
where
dt
>
20021020
;
select
*
from
t1
ignore
index
(
dt
)
where
dt
>
20021020
;
drop
table
t1
;
drop
table
t1
;
#
#
...
...
sql/item_cmpfunc.cc
View file @
7bb4166a
...
@@ -46,7 +46,7 @@ longlong Item_func_not::val_int()
...
@@ -46,7 +46,7 @@ longlong Item_func_not::val_int()
static
bool
convert_constant_item
(
Field
*
field
,
Item
**
item
)
static
bool
convert_constant_item
(
Field
*
field
,
Item
**
item
)
{
{
if
((
*
item
)
->
const_item
()
&&
(
*
item
)
->
type
()
!=
Item
::
INT_ITEM
)
if
((
*
item
)
->
const_item
())
{
{
if
(
!
(
*
item
)
->
save_in_field
(
field
,
1
)
&&
if
(
!
(
*
item
)
->
save_in_field
(
field
,
1
)
&&
!
((
*
item
)
->
null_value
))
!
((
*
item
)
->
null_value
))
...
...
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