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
bcbc9ff2
Commit
bcbc9ff2
authored
Jan 17, 2004
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Plain Diff
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/bk/work-sub-4.1
parents
41323e8b
e756a511
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
52 additions
and
8 deletions
+52
-8
mysql-test/r/subselect_innodb.result
mysql-test/r/subselect_innodb.result
+20
-0
mysql-test/t/subselect_innodb.test
mysql-test/t/subselect_innodb.test
+23
-1
sql/item_subselect.cc
sql/item_subselect.cc
+3
-2
sql/sql_derived.cc
sql/sql_derived.cc
+1
-1
sql/sql_lex.h
sql/sql_lex.h
+1
-1
sql/sql_union.cc
sql/sql_union.cc
+4
-3
No files found.
mysql-test/r/subselect_innodb.result
View file @
bcbc9ff2
...
...
@@ -63,3 +63,23 @@ processor_id (SELECT y.yod_id FROM t1 p2, t2 y WHERE p2.processor_id = p1.proces
2 1
3 1
drop table t1,t2,t3;
CREATE TABLE t1 (
id int(11) NOT NULL default '0',
b int(11) default NULL,
c char(3) default NULL,
PRIMARY KEY (id),
KEY t2i1 (b)
) TYPE=innodb DEFAULT CHARSET=latin1;
INSERT INTO t1 VALUES (0,0,'GPL'),(1,0,'GPL'),(2,1,'GPL'),(3,2,'GPL');
CREATE TABLE t2 (
id int(11) NOT NULL default '0',
b int(11) default NULL,
c char(3) default NULL,
PRIMARY KEY (id),
KEY t2i (b)
) TYPE=innodb DEFAULT CHARSET=latin1;
INSERT INTO t2 VALUES (0,0,'GPL'),(1,0,'GPL'),(2,1,'GPL'),(3,2,'GPL');
select (select max(id) from t2 where b=1 group by b) as x,b from t1 where b=1;
x b
2 1
drop table t1,t2;
mysql-test/t/subselect_innodb.test
View file @
bcbc9ff2
...
...
@@ -67,4 +67,26 @@ INSERT INTO t1 VALUES (1),(2),(3);
INSERT
INTO
t3
VALUES
(
1
,
1
),(
2
,
2
),(
3
,
3
);
INSERT
INTO
t2
VALUES
(
1
,
1
),(
2
,
2
),(
3
,
3
);
SELECT
distinct
p1
.
processor_id
,
(
SELECT
y
.
yod_id
FROM
t1
p2
,
t2
y
WHERE
p2
.
processor_id
=
p1
.
processor_id
and
p2
.
processor_id
=
y
.
processor_id
)
FROM
t1
p1
;
drop
table
t1
,
t2
,
t3
;
\ No newline at end of file
drop
table
t1
,
t2
,
t3
;
#
# innodb locking
#
CREATE
TABLE
t1
(
id
int
(
11
)
NOT
NULL
default
'0'
,
b
int
(
11
)
default
NULL
,
c
char
(
3
)
default
NULL
,
PRIMARY
KEY
(
id
),
KEY
t2i1
(
b
)
)
TYPE
=
innodb
DEFAULT
CHARSET
=
latin1
;
INSERT
INTO
t1
VALUES
(
0
,
0
,
'GPL'
),(
1
,
0
,
'GPL'
),(
2
,
1
,
'GPL'
),(
3
,
2
,
'GPL'
);
CREATE
TABLE
t2
(
id
int
(
11
)
NOT
NULL
default
'0'
,
b
int
(
11
)
default
NULL
,
c
char
(
3
)
default
NULL
,
PRIMARY
KEY
(
id
),
KEY
t2i
(
b
)
)
TYPE
=
innodb
DEFAULT
CHARSET
=
latin1
;
INSERT
INTO
t2
VALUES
(
0
,
0
,
'GPL'
),(
1
,
0
,
'GPL'
),(
2
,
1
,
'GPL'
),(
3
,
2
,
'GPL'
);
select
(
select
max
(
id
)
from
t2
where
b
=
1
group
by
b
)
as
x
,
b
from
t1
where
b
=
1
;
drop
table
t1
,
t2
;
sql/item_subselect.cc
View file @
bcbc9ff2
...
...
@@ -906,7 +906,8 @@ int subselect_single_select_engine::prepare()
{
if
(
prepared
)
return
0
;
join
=
new
JOIN
(
thd
,
select_lex
->
item_list
,
select_lex
->
options
,
result
);
join
=
new
JOIN
(
thd
,
select_lex
->
item_list
,
select_lex
->
options
|
SELECT_NO_UNLOCK
,
result
);
if
(
!
join
||
!
result
)
{
thd
->
fatal_error
();
//out of memory
...
...
@@ -933,7 +934,7 @@ int subselect_single_select_engine::prepare()
int
subselect_union_engine
::
prepare
()
{
return
unit
->
prepare
(
thd
,
result
);
return
unit
->
prepare
(
thd
,
result
,
SELECT_NO_UNLOCK
);
}
int
subselect_uniquesubquery_engine
::
prepare
()
...
...
sql/sql_derived.cc
View file @
bcbc9ff2
...
...
@@ -114,7 +114,7 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit,
DBUG_RETURN
(
1
);
// out of memory
// st_select_lex_unit::prepare correctly work for single select
if
((
res
=
unit
->
prepare
(
thd
,
derived_result
)))
if
((
res
=
unit
->
prepare
(
thd
,
derived_result
,
0
)))
goto
exit
;
/*
...
...
sql/sql_lex.h
View file @
bcbc9ff2
...
...
@@ -351,7 +351,7 @@ class st_select_lex_unit: public st_select_lex_node {
void
exclude_tree
();
/* UNION methods */
int
prepare
(
THD
*
thd
,
select_result
*
result
);
int
prepare
(
THD
*
thd
,
select_result
*
result
,
ulong
additional_options
);
int
exec
();
int
cleanup
();
...
...
sql/sql_union.cc
View file @
bcbc9ff2
...
...
@@ -29,7 +29,7 @@ int mysql_union(THD *thd, LEX *lex, select_result *result,
{
DBUG_ENTER
(
"mysql_union"
);
int
res
=
0
;
if
(
!
(
res
=
unit
->
prepare
(
thd
,
result
)))
if
(
!
(
res
=
unit
->
prepare
(
thd
,
result
,
SELECT_NO_UNLOCK
)))
res
=
unit
->
exec
();
res
|=
unit
->
cleanup
();
DBUG_RETURN
(
res
);
...
...
@@ -106,7 +106,8 @@ bool select_union::flush()
}
int
st_select_lex_unit
::
prepare
(
THD
*
thd_arg
,
select_result
*
sel_result
)
int
st_select_lex_unit
::
prepare
(
THD
*
thd_arg
,
select_result
*
sel_result
,
ulong
additional_options
)
{
SELECT_LEX
*
lex_select_save
=
thd_arg
->
lex
->
current_select
;
SELECT_LEX
*
sl
,
*
first_select
;
...
...
@@ -146,7 +147,7 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result)
for
(;
sl
;
sl
=
sl
->
next_select
())
{
JOIN
*
join
=
new
JOIN
(
thd_arg
,
sl
->
item_list
,
sl
->
options
|
thd_arg
->
options
|
SELECT_NO_UNLOCK
,
sl
->
options
|
thd_arg
->
options
|
additional_options
,
tmp_result
);
thd_arg
->
lex
->
current_select
=
sl
;
offset_limit_cnt
=
sl
->
offset_limit
;
...
...
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