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
caa9645c
Commit
caa9645c
authored
Oct 24, 2003
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
f349adf8
6300a019
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
5 deletions
+31
-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
sql/item_sum.cc
sql/item_sum.cc
+1
-0
No files found.
mysql-test/r/subselect.result
View file @
caa9645c
...
@@ -1475,6 +1475,13 @@ dbid name
...
@@ -1475,6 +1475,13 @@ dbid name
-1 Valid
-1 Valid
-1 Valid 2
-1 Valid 2
drop table t1,t2,t3,t4;
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;
create table t1 (s1 int);
create table t1 (s1 int);
insert into t1 values (1);
insert into t1 values (1);
insert into t1 values (2);
insert into t1 values (2);
...
...
mysql-test/t/subselect.test
View file @
caa9645c
...
@@ -989,6 +989,17 @@ select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >
...
@@ -989,6 +989,17 @@ select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >
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
;
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
;
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
;
#
#
# DO and SET with errors
# DO and SET with errors
#
#
...
...
sql/item_subselect.cc
View file @
caa9645c
...
@@ -514,6 +514,12 @@ Item_in_subselect::single_value_transformer(JOIN *join,
...
@@ -514,6 +514,12 @@ Item_in_subselect::single_value_transformer(JOIN *join,
THD
*
thd
=
join
->
thd
;
THD
*
thd
=
join
->
thd
;
thd
->
where
=
"scalar IN/ALL/ANY subquery"
;
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
()))
&&
if
((
abort_on_null
||
(
upper_not
&&
upper_not
->
top_level
()))
&&
!
select_lex
->
master_unit
()
->
dependent
&&
!
select_lex
->
master_unit
()
->
dependent
&&
(
func
==
&
Item_bool_func2
::
gt_creator
||
(
func
==
&
Item_bool_func2
::
gt_creator
||
...
@@ -606,11 +612,6 @@ Item_in_subselect::single_value_transformer(JOIN *join,
...
@@ -606,11 +612,6 @@ Item_in_subselect::single_value_transformer(JOIN *join,
select_lex
->
dependent
=
1
;
select_lex
->
dependent
=
1
;
Item
*
item
;
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
();
item
=
(
Item
*
)
select_lex
->
item_list
.
head
();
...
@@ -710,6 +711,12 @@ Item_in_subselect::row_value_transformer(JOIN *join,
...
@@ -710,6 +711,12 @@ Item_in_subselect::row_value_transformer(JOIN *join,
SELECT_LEX
*
select_lex
=
join
->
select_lex
;
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
)
if
(
!
substitution
)
{
{
//first call for this unit
//first call for this unit
...
...
sql/item_sum.cc
View file @
caa9645c
...
@@ -1795,6 +1795,7 @@ Item_func_group_concat::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
...
@@ -1795,6 +1795,7 @@ Item_func_group_concat::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
*/
*/
for
(
i
=
0
;
i
<
arg_count_order
;
i
++
)
for
(
i
=
0
;
i
<
arg_count_order
;
i
++
)
{
{
// order_item->item can be changed by fix_fields() call
ORDER
*
order_item
=
order
[
i
];
ORDER
*
order_item
=
order
[
i
];
if
((
*
order_item
->
item
)
->
fix_fields
(
thd
,
tables
,
order_item
->
item
)
||
if
((
*
order_item
->
item
)
->
fix_fields
(
thd
,
tables
,
order_item
->
item
)
||
(
*
order_item
->
item
)
->
check_cols
(
1
))
(
*
order_item
->
item
)
->
check_cols
(
1
))
...
...
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