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
01da03e0
Commit
01da03e0
authored
Jul 31, 2002
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge sanja.is.com.ua:/home/bell/mysql/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/work-subselect-4.1
parents
e801f5ca
07c1f3db
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
5 deletions
+27
-5
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+11
-2
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+9
-2
sql/item_subselect.cc
sql/item_subselect.cc
+7
-1
No files found.
mysql-test/r/subselect.result
View file @
01da03e0
select (select 2);
(select 2)
2
drop table if exists t1,t2,t3,t4;
drop table if exists t1,t2,t3,t4
,attend,clinic
;
create table t1 (a int);
create table t2 (a int, b int);
create table t3 (a int);
...
...
@@ -82,4 +82,13 @@ select b,max(a) as ma from t4 group by b having b >= (select max(t2.a)
from t2 where t2.b=t4.b);
b ma
7 12
drop table t1,t2,t3,t4;
create table attend (patient_uq int, clinic_uq int, index i1 (clinic_uq));
create table clinic( uq int primary key, name char(25));
insert into clinic values(1,"Oblastnaia bolnitsa"),(2,"Bolnitsa Krasnogo Kresta");
insert into attend values (1,1),(1,2),(2,2),(1,3);
select * from attend where exists (select * from clinic where uq = clinic_uq);
patient_uq clinic_uq
1 1
1 2
2 2
drop table t1,t2,t3,t4,attend,clinic;
mysql-test/t/subselect.test
View file @
01da03e0
select
(
select
2
);
drop
table
if
exists
t1
,
t2
,
t3
,
t4
;
drop
table
if
exists
t1
,
t2
,
t3
,
t4
,
attend
,
clinic
;
create
table
t1
(
a
int
);
create
table
t2
(
a
int
,
b
int
);
create
table
t3
(
a
int
);
...
...
@@ -33,4 +33,11 @@ select b,max(a) as ma from t4 group by b having b < (select max(t2.a)
from
t2
where
t2
.
b
=
t4
.
b
);
select
b
,
max
(
a
)
as
ma
from
t4
group
by
b
having
b
>=
(
select
max
(
t2
.
a
)
from
t2
where
t2
.
b
=
t4
.
b
);
drop
table
t1
,
t2
,
t3
,
t4
;
create
table
attend
(
patient_uq
int
,
clinic_uq
int
,
index
i1
(
clinic_uq
));
create
table
clinic
(
uq
int
primary
key
,
name
char
(
25
));
insert
into
clinic
values
(
1
,
"Oblastnaia bolnitsa"
),(
2
,
"Bolnitsa Krasnogo Kresta"
);
insert
into
attend
values
(
1
,
1
),(
1
,
2
),(
2
,
2
),(
1
,
3
);
select
*
from
attend
where
exists
(
select
*
from
clinic
where
uq
=
clinic_uq
);
drop
table
t1
,
t2
,
t3
,
t4
,
attend
,
clinic
;
sql/item_subselect.cc
View file @
01da03e0
...
...
@@ -51,6 +51,12 @@ Item_subselect::Item_subselect(THD *thd, st_select_lex *select_lex,
if
(
unit
->
select_limit_cnt
==
HA_POS_ERROR
)
select_lex
->
options
&=
~
OPTION_FOUND_ROWS
;
join
=
new
JOIN
(
thd
,
select_lex
->
item_list
,
select_lex
->
options
,
result
);
if
(
!
join
||
!
result
)
{
//out of memory
thd
->
fatal_error
=
1
;
my_printf_error
(
ER_OUT_OF_RESOURCES
,
ER
(
ER_OUT_OF_RESOURCES
),
MYF
(
0
));
}
this
->
select_lex
=
select_lex
;
assign_null
();
/*
...
...
@@ -172,7 +178,7 @@ String *Item_singleval_subselect::val_str (String *str)
Item_exists_subselect
::
Item_exists_subselect
(
THD
*
thd
,
st_select_lex
*
select_lex
)
:
Item_subselect
(
thd
,
select_lex
,
new
select_
singleval
_subselect
(
this
))
Item_subselect
(
thd
,
select_lex
,
new
select_
exists
_subselect
(
this
))
{
max_columns
=
UINT_MAX
;
null_value
=
0
;
//can't be NULL
...
...
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