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
18d722ff
Commit
18d722ff
authored
Mar 04, 2004
by
hf@deer.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merging
parents
b0491594
dff5b0a7
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
0 deletions
+23
-0
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+10
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+6
-0
sql/item_subselect.cc
sql/item_subselect.cc
+6
-0
sql/item_subselect.h
sql/item_subselect.h
+1
-0
No files found.
mysql-test/r/subselect.result
View file @
18d722ff
...
@@ -1569,6 +1569,16 @@ INSERT INTO t2 VALUES (100, 200, 'C');
...
@@ -1569,6 +1569,16 @@ 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);
SELECT DISTINCT COLC FROM t1 WHERE COLA = (SELECT COLA FROM t2 WHERE COLB = 200 AND COLC ='C' LIMIT 1);
COLC
COLC
DROP TABLE t1, t2;
DROP TABLE t1, t2;
CREATE TABLE t1 (a int(1));
INSERT INTO t1 VALUES (1),(1),(1),(1),(1),(2),(3),(4),(5);
SELECT DISTINCT (SELECT a) FROM t1 LIMIT 100;
(SELECT a)
1
2
3
4
5
DROP TABLE t1;
create table t1 (a int, b decimal(13, 3));
create table t1 (a int, b decimal(13, 3));
insert into t1 values (1, 0.123);
insert into t1 values (1, 0.123);
select a, (select max(b) from t1) into outfile "subselect.out.file.1" from t1;
select a, (select max(b) from t1) into outfile "subselect.out.file.1" from t1;
...
...
mysql-test/t/subselect.test
View file @
18d722ff
...
@@ -1010,6 +1010,11 @@ INSERT INTO t2 VALUES (100, 200, 'C');
...
@@ -1010,6 +1010,11 @@ 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
);
SELECT
DISTINCT
COLC
FROM
t1
WHERE
COLA
=
(
SELECT
COLA
FROM
t2
WHERE
COLB
=
200
AND
COLC
=
'C'
LIMIT
1
);
DROP
TABLE
t1
,
t2
;
DROP
TABLE
t1
,
t2
;
CREATE
TABLE
t1
(
a
int
(
1
));
INSERT
INTO
t1
VALUES
(
1
),(
1
),(
1
),(
1
),(
1
),(
2
),(
3
),(
4
),(
5
);
SELECT
DISTINCT
(
SELECT
a
)
FROM
t1
LIMIT
100
;
DROP
TABLE
t1
;
#
#
# Bug 2198
# Bug 2198
#
#
...
@@ -1060,3 +1065,4 @@ select sum(a) from (select * from t1) as a;
...
@@ -1060,3 +1065,4 @@ select sum(a) from (select * from t1) as a;
select
2
in
(
select
*
from
t1
);
select
2
in
(
select
*
from
t1
);
SET
SQL_SELECT_LIMIT
=
default
;
SET
SQL_SELECT_LIMIT
=
default
;
drop
table
t1
;
drop
table
t1
;
sql/item_subselect.cc
View file @
18d722ff
...
@@ -198,6 +198,12 @@ bool Item_subselect::const_item() const
...
@@ -198,6 +198,12 @@ bool Item_subselect::const_item() const
return
const_item_cache
;
return
const_item_cache
;
}
}
Item
*
Item_subselect
::
get_tmp_table_item
(
THD
*
thd
)
{
if
(
!
with_sum_func
&&
!
const_item
())
return
new
Item_field
(
result_field
);
return
copy_or_same
(
thd
);
}
void
Item_subselect
::
update_used_tables
()
void
Item_subselect
::
update_used_tables
()
{
{
...
...
sql/item_subselect.h
View file @
18d722ff
...
@@ -99,6 +99,7 @@ class Item_subselect :public Item_result_field
...
@@ -99,6 +99,7 @@ class Item_subselect :public Item_result_field
bool
const_item
()
const
;
bool
const_item
()
const
;
inline
table_map
get_used_tables_cache
()
{
return
used_tables_cache
;
}
inline
table_map
get_used_tables_cache
()
{
return
used_tables_cache
;
}
inline
bool
get_const_item_cache
()
{
return
const_item_cache
;
}
inline
bool
get_const_item_cache
()
{
return
const_item_cache
;
}
Item
*
get_tmp_table_item
(
THD
*
thd
);
void
update_used_tables
();
void
update_used_tables
();
void
print
(
String
*
str
);
void
print
(
String
*
str
);
bool
change_engine
(
subselect_engine
*
eng
)
bool
change_engine
(
subselect_engine
*
eng
)
...
...
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