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
de8f0595
Commit
de8f0595
authored
Jun 20, 2006
by
evgen@moonbone.local
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
e4208733
279c310b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
61 deletions
+8
-61
mysql-test/r/func_in.result
mysql-test/r/func_in.result
+0
-29
mysql-test/t/func_in.test
mysql-test/t/func_in.test
+0
-12
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+8
-20
No files found.
mysql-test/r/func_in.result
View file @
de8f0595
...
@@ -202,35 +202,6 @@ select count(*) from t1 where id not in (1,2);
...
@@ -202,35 +202,6 @@ select count(*) from t1 where id not in (1,2);
count(*)
count(*)
1
1
drop table t1;
drop table t1;
create table t1 (f1 char(1), f2 int);
insert into t1 values (1,0),('a',1),('z',2);
select f1 from t1 where f1 in (1,'z');
f1
1
z
select f2 from t1 where f2 in (1,'z');
f2
0
1
Warnings:
Warning 1292 Truncated incorrect INTEGER value: 'z'
select f1 from t1 where 'z' in (1,f1);
f1
z
select * from t1 where 'z' in (f2,f1);
f1 f2
1 0
a 1
z 2
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'z'
Warning 1292 Truncated incorrect DOUBLE value: 'z'
Warning 1292 Truncated incorrect DOUBLE value: 'z'
select * from t1 where 1 in (f2,f1);
f1 f2
1 0
a 1
drop table t1;
CREATE TABLE t1 (a int PRIMARY KEY);
CREATE TABLE t1 (a int PRIMARY KEY);
INSERT INTO t1 VALUES (44), (45), (46);
INSERT INTO t1 VALUES (44), (45), (46);
SELECT * FROM t1 WHERE a IN (45);
SELECT * FROM t1 WHERE a IN (45);
...
...
mysql-test/t/func_in.test
View file @
de8f0595
...
@@ -109,18 +109,6 @@ select count(*) from t1 where id not in (1);
...
@@ -109,18 +109,6 @@ select count(*) from t1 where id not in (1);
select
count
(
*
)
from
t1
where
id
not
in
(
1
,
2
);
select
count
(
*
)
from
t1
where
id
not
in
(
1
,
2
);
drop
table
t1
;
drop
table
t1
;
#
# Bug#18360 Incorrect type coercion in IN() results in false comparison
#
create
table
t1
(
f1
char
(
1
),
f2
int
);
insert
into
t1
values
(
1
,
0
),(
'a'
,
1
),(
'z'
,
2
);
select
f1
from
t1
where
f1
in
(
1
,
'z'
);
select
f2
from
t1
where
f2
in
(
1
,
'z'
);
select
f1
from
t1
where
'z'
in
(
1
,
f1
);
select
*
from
t1
where
'z'
in
(
f2
,
f1
);
select
*
from
t1
where
1
in
(
f2
,
f1
);
drop
table
t1
;
# End of 4.1 tests
# End of 4.1 tests
#
#
...
...
sql/item_cmpfunc.cc
View file @
de8f0595
...
@@ -80,9 +80,6 @@ static void agg_result_type(Item_result *type, Item **items, uint nitems)
...
@@ -80,9 +80,6 @@ static void agg_result_type(Item_result *type, Item **items, uint nitems)
NOTES
NOTES
Aggregation rules:
Aggregation rules:
If all items are constants the type will be aggregated from all items.
If there are some non-constant items then only types of non-constant
items will be used for aggregation.
If there are DATE/TIME fields/functions in the list and no string
If there are DATE/TIME fields/functions in the list and no string
fields/functions in the list then:
fields/functions in the list then:
The INT_RESULT type will be used for aggregation instead of original
The INT_RESULT type will be used for aggregation instead of original
...
@@ -169,34 +166,25 @@ static void agg_cmp_type(THD *thd, Item_result *type, Item **items, uint nitems)
...
@@ -169,34 +166,25 @@ static void agg_cmp_type(THD *thd, Item_result *type, Item **items, uint nitems)
}
}
}
}
}
}
/* Reset to 0 on first occurence of non-const item. 1 otherwise */
bool
is_const
=
items
[
0
]
->
const_item
();
/*
/*
If the first item is a date/time function then its result should be
If the first item is a date/time function then its result should be
compared as int
compared as int
*/
*/
if
(
field
)
if
(
field
)
{
/* Suppose we are comparing dates */
/* Suppose we are comparing dates and some non-constant items are present. */
type
[
0
]
=
INT_RESULT
;
type
[
0
]
=
INT_RESULT
;
is_const
=
0
;
}
else
else
type
[
0
]
=
items
[
0
]
->
result_type
();
type
[
0
]
=
items
[
0
]
->
result_type
();
for
(
i
=
0
;
i
<
nitems
;
i
++
)
for
(
i
=
0
;
i
<
nitems
;
i
++
)
{
{
if
(
!
items
[
i
]
->
const_item
())
Item_result
result
=
items
[
i
]
->
result_type
();
{
if
(
field
&&
Item_result
result
=
field
&&
items
[
i
]
->
result_as_longlong
()
?
((
!
items
[
i
]
->
const_item
()
&&
items
[
i
]
->
result_as_longlong
())
||
INT_RESULT
:
items
[
i
]
->
result_type
();
(
items
[
i
]
->
const_item
()
&&
convert_constant_item
(
thd
,
field
,
type
[
0
]
=
is_const
?
result
:
item_cmp_type
(
type
[
0
],
result
);
&
items
[
i
]))))
is_const
=
0
;
result
=
INT_RESULT
;
}
type
[
0
]
=
item_cmp_type
(
type
[
0
],
result
);
else
if
(
is_const
)
type
[
0
]
=
item_cmp_type
(
type
[
0
],
items
[
i
]
->
result_type
());
else
if
(
field
)
convert_constant_item
(
thd
,
field
,
&
items
[
i
]);
}
}
if
(
res
==
Item
::
FUNC_ITEM
&&
field
)
if
(
res
==
Item
::
FUNC_ITEM
&&
field
)
...
...
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