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
8bdd6c04
Commit
8bdd6c04
authored
Nov 02, 2003
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
106ae8ed
31e42be6
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
29 additions
and
16 deletions
+29
-16
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+7
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+10
-0
sql/item_subselect.cc
sql/item_subselect.cc
+5
-7
sql/item_subselect.h
sql/item_subselect.h
+1
-3
sql/set_var.cc
sql/set_var.cc
+5
-1
sql/sql_select.cc
sql/sql_select.cc
+1
-5
No files found.
mysql-test/r/subselect.result
View file @
8bdd6c04
...
...
@@ -1486,3 +1486,10 @@ ERROR 42S22: Unknown column 't1.s2' in 'group statement'
select count(*) from t2 group by t1.s2;
ERROR 42S02: Unknown table 't1' in group statement
drop table t1, t2;
CREATE TABLE t1(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC VARCHAR(20) DEFAULT NULL,PRIMARY KEY (COLA, COLB));
CREATE TABLE t2(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC CHAR(1) NOT NULL,PRIMARY KEY (COLA));
INSERT INTO t1 VALUES (1,1,'1A3240'), (1,2,'4W2365');
INSERT INTO t2 VALUES (100, 200, 'C');
SELECT DISTINCT COLC FROM t1 WHERE COLA = (SELECT COLA FROM t2 WHERE COLB = 200 AND COLC ='C' LIMIT 1);
COLC
DROP TABLE t1, t2;
mysql-test/t/subselect.test
View file @
8bdd6c04
...
...
@@ -999,3 +999,13 @@ select * from t1 where (select count(*) from t2 group by t1.s2) = 1;
--
error
1109
select
count
(
*
)
from
t2
group
by
t1
.
s2
;
drop
table
t1
,
t2
;
#
# fix_fields() in add_ref_to_table_cond()
#
CREATE
TABLE
t1
(
COLA
FLOAT
NOT
NULL
,
COLB
FLOAT
NOT
NULL
,
COLC
VARCHAR
(
20
)
DEFAULT
NULL
,
PRIMARY
KEY
(
COLA
,
COLB
));
CREATE
TABLE
t2
(
COLA
FLOAT
NOT
NULL
,
COLB
FLOAT
NOT
NULL
,
COLC
CHAR
(
1
)
NOT
NULL
,
PRIMARY
KEY
(
COLA
));
INSERT
INTO
t1
VALUES
(
1
,
1
,
'1A3240'
),
(
1
,
2
,
'4W2365'
);
INSERT
INTO
t2
VALUES
(
100
,
200
,
'C'
);
SELECT
DISTINCT
COLC
FROM
t1
WHERE
COLA
=
(
SELECT
COLA
FROM
t2
WHERE
COLB
=
200
AND
COLC
=
'C'
LIMIT
1
);
DROP
TABLE
t1
,
t2
;
s
sql/item_subselect.cc
View file @
8bdd6c04
...
...
@@ -512,7 +512,6 @@ String *Item_in_subselect::val_str(String *str)
Item_subselect
::
trans_res
Item_in_subselect
::
single_value_transformer
(
JOIN
*
join
,
Item
*
left_expr
,
compare_func_creator
func
)
{
DBUG_ENTER
(
"Item_in_subselect::single_value_transformer"
);
...
...
@@ -587,7 +586,7 @@ Item_in_subselect::single_value_transformer(JOIN *join,
// left expression belong to outer select
SELECT_LEX
*
current
=
thd
->
lex
.
current_select
,
*
up
;
thd
->
lex
.
current_select
=
up
=
current
->
return_after_parsing
();
if
(
left_expr
->
fix_fields
(
thd
,
up
->
get_table_list
(),
0
))
if
(
left_expr
->
fix_fields
(
thd
,
up
->
get_table_list
(),
&
left_expr
))
{
thd
->
lex
.
current_select
=
current
;
DBUG_RETURN
(
RES_ERROR
);
...
...
@@ -716,8 +715,7 @@ Item_in_subselect::single_value_transformer(JOIN *join,
}
Item_subselect
::
trans_res
Item_in_subselect
::
row_value_transformer
(
JOIN
*
join
,
Item
*
left_expr
)
Item_in_subselect
::
row_value_transformer
(
JOIN
*
join
)
{
DBUG_ENTER
(
"Item_in_subselect::row_value_transformer"
);
...
...
@@ -800,16 +798,16 @@ Item_subselect::trans_res
Item_in_subselect
::
select_transformer
(
JOIN
*
join
)
{
if
(
left_expr
->
cols
()
==
1
)
return
single_value_transformer
(
join
,
left_expr
,
return
single_value_transformer
(
join
,
&
Item_bool_func2
::
eq_creator
);
return
row_value_transformer
(
join
,
left_expr
);
return
row_value_transformer
(
join
);
}
Item_subselect
::
trans_res
Item_allany_subselect
::
select_transformer
(
JOIN
*
join
)
{
return
single_value_transformer
(
join
,
left_expr
,
func
);
return
single_value_transformer
(
join
,
func
);
}
subselect_single_select_engine
::
...
...
sql/item_subselect.h
View file @
8bdd6c04
...
...
@@ -210,10 +210,8 @@ class Item_in_subselect :public Item_exists_subselect
}
trans_res
select_transformer
(
JOIN
*
join
);
trans_res
single_value_transformer
(
JOIN
*
join
,
Item
*
left_expr
,
compare_func_creator
func
);
trans_res
row_value_transformer
(
JOIN
*
join
,
Item
*
left_expr
);
trans_res
row_value_transformer
(
JOIN
*
join
);
longlong
val_int
();
double
val
();
String
*
val_str
(
String
*
);
...
...
sql/set_var.cc
View file @
8bdd6c04
...
...
@@ -2279,7 +2279,11 @@ int set_var::update(THD *thd)
int
set_var_user
::
check
(
THD
*
thd
)
{
return
(
user_var_item
->
fix_fields
(
thd
,
0
,
(
Item
**
)
0
)
||
/*
Item_func_set_user_var can't substitute something else on its place =>
0 can be passed as last argument
*/
return
(
user_var_item
->
fix_fields
(
thd
,
0
,
(
Item
**
)
0
)
||
user_var_item
->
check
())
?
-
1
:
0
;
}
...
...
sql/sql_select.cc
View file @
8bdd6c04
...
...
@@ -8525,11 +8525,7 @@ static bool add_ref_to_table_cond(THD *thd, JOIN_TAB *join_tab)
if
(
thd
->
is_fatal_error
)
DBUG_RETURN
(
TRUE
);
/*
Here we pass 0 as the first argument to fix_fields that don't need
to do any stack checking (This is already done in the initial fix_fields).
*/
cond
->
fix_fields
((
THD
*
)
0
,(
TABLE_LIST
*
)
0
,
(
Item
**
)
&
cond
);
cond
->
fix_fields
(
thd
,(
TABLE_LIST
*
)
0
,
(
Item
**
)
&
cond
);
if
(
join_tab
->
select
)
{
error
=
(
int
)
cond
->
add
(
join_tab
->
select
->
cond
);
...
...
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