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
6457b899
Commit
6457b899
authored
Oct 23, 2003
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added check of cardinality to IN/ALL/ANY subquery transformer
(BUG#1638)
parent
5fb30467
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
5 deletions
+30
-5
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+7
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+11
-0
sql/item_subselect.cc
sql/item_subselect.cc
+12
-5
No files found.
mysql-test/r/subselect.result
View file @
6457b899
...
...
@@ -1457,3 +1457,10 @@ dbid name
-1 Valid
-1 Valid 2
drop table t1,t2,t3,t4;
CREATE TABLE t1 (id int(11) default NULL) TYPE=MyISAM CHARSET=latin1;
INSERT INTO t1 VALUES (1),(5);
CREATE TABLE t2 (id int(11) default NULL) TYPE=MyISAM CHARSET=latin1;
INSERT INTO t2 VALUES (2),(6);
select * from t1 where (1,2,6) in (select * from t2);
ERROR 21000: Operand should contain 3 column(s)
DROP TABLE t1,t2;
mysql-test/t/subselect.test
View file @
6457b899
...
...
@@ -981,3 +981,14 @@ INSERT INTO `t4` (`task_id`, `description`) VALUES (1, 'Daily Check List'),(2, '
select
dbid
,
name
,
(
date_format
(
now
()
,
'%Y-%m-%d'
)
-
INTERVAL
how_often
DAY
)
>=
ifnull
((
SELECT
date_format
(
max
(
create_date
),
'%Y-%m-%d'
)
FROM
t1
WHERE
dbid
=
b
.
db_id
AND
taskid
=
a
.
taskgenid
),
'1950-01-01'
)
from
t3
a
,
t2
b
,
t4
WHERE
dbid
=
-
1
AND
primary_uid
=
'1'
AND
t4
.
task_id
=
taskid
;
SELECT
dbid
,
name
FROM
t3
a
,
t2
b
,
t4
WHERE
dbid
=
-
1
AND
primary_uid
=
'1'
AND
((
date_format
(
now
()
,
'%Y-%m-%d'
)
-
INTERVAL
how_often
DAY
)
>=
ifnull
((
SELECT
date_format
(
max
(
create_date
),
'%Y-%m-%d'
)
FROM
t1
WHERE
dbid
=
b
.
db_id
AND
taskid
=
a
.
taskgenid
),
'1950-01-01'
))
AND
t4
.
task_id
=
taskid
;
drop
table
t1
,
t2
,
t3
,
t4
;
#
# cardinality check
#
CREATE
TABLE
t1
(
id
int
(
11
)
default
NULL
)
TYPE
=
MyISAM
CHARSET
=
latin1
;
INSERT
INTO
t1
VALUES
(
1
),(
5
);
CREATE
TABLE
t2
(
id
int
(
11
)
default
NULL
)
TYPE
=
MyISAM
CHARSET
=
latin1
;
INSERT
INTO
t2
VALUES
(
2
),(
6
);
--
error
1240
select
*
from
t1
where
(
1
,
2
,
6
)
in
(
select
*
from
t2
);
DROP
TABLE
t1
,
t2
;
sql/item_subselect.cc
View file @
6457b899
...
...
@@ -514,6 +514,12 @@ Item_in_subselect::single_value_transformer(JOIN *join,
THD
*
thd
=
join
->
thd
;
thd
->
where
=
"scalar IN/ALL/ANY subquery"
;
if
(
select_lex
->
item_list
.
elements
>
1
)
{
my_error
(
ER_OPERAND_COLUMNS
,
MYF
(
0
),
1
);
DBUG_RETURN
(
RES_ERROR
);
}
if
((
abort_on_null
||
(
upper_not
&&
upper_not
->
top_level
()))
&&
!
select_lex
->
master_unit
()
->
dependent
&&
(
func
==
&
Item_bool_func2
::
gt_creator
||
...
...
@@ -606,11 +612,6 @@ Item_in_subselect::single_value_transformer(JOIN *join,
select_lex
->
dependent
=
1
;
Item
*
item
;
if
(
select_lex
->
item_list
.
elements
>
1
)
{
my_error
(
ER_OPERAND_COLUMNS
,
MYF
(
0
),
1
);
DBUG_RETURN
(
RES_ERROR
);
}
item
=
(
Item
*
)
select_lex
->
item_list
.
head
();
...
...
@@ -710,6 +711,12 @@ Item_in_subselect::row_value_transformer(JOIN *join,
SELECT_LEX
*
select_lex
=
join
->
select_lex
;
if
(
select_lex
->
item_list
.
elements
!=
left_expr
->
cols
())
{
my_error
(
ER_OPERAND_COLUMNS
,
MYF
(
0
),
left_expr
->
cols
());
DBUG_RETURN
(
RES_ERROR
);
}
if
(
!
substitution
)
{
//first call for this unit
...
...
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