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
dcd6e3d0
Commit
dcd6e3d0
authored
Nov 17, 2004
by
unknown
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-global-4.1
parents
3a301ac1
70ed3160
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
56 additions
and
6 deletions
+56
-6
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+21
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+27
-0
sql/ha_myisam.h
sql/ha_myisam.h
+0
-1
sql/handler.h
sql/handler.h
+1
-0
sql/opt_range.h
sql/opt_range.h
+1
-1
sql/sql_class.h
sql/sql_class.h
+1
-1
sql/sql_lex.cc
sql/sql_lex.cc
+1
-0
sql/sql_parse.cc
sql/sql_parse.cc
+0
-1
sql/sql_select.cc
sql/sql_select.cc
+4
-2
No files found.
mysql-test/r/subselect.result
View file @
dcd6e3d0
...
...
@@ -1990,3 +1990,24 @@ ac
700
NULL
drop tables t1,t2;
set @got_val= (SELECT 1 FROM (SELECT 'A' as my_col) as T1 ) ;
create table t1 (a int, b int);
create table t2 (a int, b int);
insert into t1 values (1,1),(1,2),(1,3),(2,4),(2,5);
insert into t2 values (1,3),(2,1);
select distinct a,b, (select max(b) from t2 where t1.b=t2.a) from t1 order by t1.b;
a b (select max(b) from t2 where t1.b=t2.a)
1 1 3
1 2 1
1 3 NULL
2 4 NULL
2 5 NULL
drop table t1, t2;
create table t1 (id int);
create table t2 (id int, body text, fulltext (body));
insert into t1 values(1),(2),(3);
insert into t2 values (1,'test'), (2,'mysql'), (3,'test'), (4,'test');
select count(distinct id) from t1 where id in (select id from t2 where match(body) against ('mysql' in boolean mode));
count(distinct id)
1
drop table t2,t1;
mysql-test/t/subselect.test
View file @
dcd6e3d0
...
...
@@ -1282,3 +1282,30 @@ INSERT INTO `t2` VALUES (6,5,12,7,'a'),(12,0,0,7,'a'),(12,1,0,7,'a'),(12,5,5,7,'
SELECT
b
.
sc
FROM
(
SELECT
(
SELECT
a
.
access
FROM
t1
a
WHERE
a
.
map
=
op
.
map
AND
a
.
slave
=
op
.
pid
AND
a
.
master
=
1
)
ac
FROM
t2
op
WHERE
op
.
id
=
12
AND
op
.
map
=
0
)
b
;
SELECT
b
.
ac
FROM
(
SELECT
(
SELECT
a
.
access
FROM
t1
a
WHERE
a
.
map
=
op
.
map
AND
a
.
slave
=
op
.
pid
AND
a
.
master
=
1
)
ac
FROM
t2
op
WHERE
op
.
id
=
12
AND
op
.
map
=
0
)
b
;
drop
tables
t1
,
t2
;
#
# Subselect in non-select command just after connection
#
connect
(
root
,
localhost
,
root
,,
test
,
$MASTER_MYPORT
,
$MASTER_MYSOCK
);
connection
root
;
set
@
got_val
=
(
SELECT
1
FROM
(
SELECT
'A'
as
my_col
)
as
T1
)
;
#
# primary query with temporary table and subquery with groupping
#
create
table
t1
(
a
int
,
b
int
);
create
table
t2
(
a
int
,
b
int
);
insert
into
t1
values
(
1
,
1
),(
1
,
2
),(
1
,
3
),(
2
,
4
),(
2
,
5
);
insert
into
t2
values
(
1
,
3
),(
2
,
1
);
select
distinct
a
,
b
,
(
select
max
(
b
)
from
t2
where
t1
.
b
=
t2
.
a
)
from
t1
order
by
t1
.
b
;
drop
table
t1
,
t2
;
#
# subqueries with full text search
#
create
table
t1
(
id
int
);
create
table
t2
(
id
int
,
body
text
,
fulltext
(
body
));
insert
into
t1
values
(
1
),(
2
),(
3
);
insert
into
t2
values
(
1
,
'test'
),
(
2
,
'mysql'
),
(
3
,
'test'
),
(
4
,
'test'
);
select
count
(
distinct
id
)
from
t1
where
id
in
(
select
id
from
t2
where
match
(
body
)
against
(
'mysql'
in
boolean
mode
));
drop
table
t2
,
t1
;
sql/ha_myisam.h
View file @
dcd6e3d0
...
...
@@ -81,7 +81,6 @@ class ha_myisam: public handler
int
index_first
(
byte
*
buf
);
int
index_last
(
byte
*
buf
);
int
index_next_same
(
byte
*
buf
,
const
byte
*
key
,
uint
keylen
);
int
index_end
()
{
ft_handler
=
NULL
;
return
0
;
}
int
ft_init
()
{
if
(
!
ft_handler
)
...
...
sql/handler.h
View file @
dcd6e3d0
...
...
@@ -372,6 +372,7 @@ class handler :public Sql_alloc
virtual
int
read_range_next
();
int
compare_key
(
key_range
*
range
);
virtual
int
ft_init
()
{
return
HA_ERR_WRONG_COMMAND
;
}
void
ft_end
()
{
ft_handler
=
NULL
;
}
virtual
FT_INFO
*
ft_init_ext
(
uint
flags
,
uint
inx
,
const
byte
*
key
,
uint
keylen
)
{
return
NULL
;
}
...
...
sql/opt_range.h
View file @
dcd6e3d0
...
...
@@ -154,7 +154,7 @@ class FT_SELECT: public QUICK_SELECT {
public:
FT_SELECT
(
THD
*
thd
,
TABLE
*
table
,
uint
key
)
:
QUICK_SELECT
(
thd
,
table
,
key
,
1
)
{
init
();
}
~
FT_SELECT
()
{
file
->
ft_end
();
}
int
init
()
{
return
error
=
file
->
ft_init
();
}
int
get_next
()
{
return
error
=
file
->
ft_read
(
record
);
}
};
...
...
sql/sql_class.h
View file @
dcd6e3d0
...
...
@@ -1305,7 +1305,7 @@ class TMP_TABLE_PARAM :public Sql_alloc
if
(
copy_field
)
/* Fix for Intel compiler */
{
delete
[]
copy_field
;
copy_field
=
0
;
save_copy_field
=
copy_field
=
0
;
}
}
};
...
...
sql/sql_lex.cc
View file @
dcd6e3d0
...
...
@@ -157,6 +157,7 @@ void lex_start(THD *thd, uchar *buf,uint length)
lex
->
ignore_space
=
test
(
thd
->
variables
.
sql_mode
&
MODE_IGNORE_SPACE
);
lex
->
sql_command
=
SQLCOM_END
;
lex
->
duplicates
=
DUP_ERROR
;
lex
->
proc_list
.
first
=
0
;
}
void
lex_end
(
LEX
*
lex
)
...
...
sql/sql_parse.cc
View file @
dcd6e3d0
...
...
@@ -3940,7 +3940,6 @@ mysql_init_select(LEX *lex)
{
DBUG_ASSERT
(
lex
->
result
==
0
);
lex
->
exchange
=
0
;
lex
->
proc_list
.
first
=
0
;
}
}
...
...
sql/sql_select.cc
View file @
dcd6e3d0
...
...
@@ -936,7 +936,7 @@ JOIN::optimize()
}
}
if
(
select_lex
->
master_unit
()
->
uncacheable
)
if
(
select_lex
->
uncacheable
)
{
if
(
!
(
tmp_join
=
(
JOIN
*
)
thd
->
alloc
(
sizeof
(
JOIN
))))
DBUG_RETURN
(
-
1
);
...
...
@@ -3833,7 +3833,8 @@ JOIN::join_free(bool full)
JOIN_TAB
*
tab
,
*
end
;
DBUG_ENTER
(
"JOIN::join_free"
);
full
=
full
||
!
select_lex
->
uncacheable
;
full
=
full
||
(
!
select_lex
->
uncacheable
&&
!
thd
->
lex
->
describe
);
// do not cleanup too early on EXPLAIN
if
(
table
)
{
...
...
@@ -3862,6 +3863,7 @@ JOIN::join_free(bool full)
for
(
tab
=
join_tab
,
end
=
tab
+
tables
;
tab
!=
end
;
tab
++
)
tab
->
cleanup
();
table
=
0
;
tables
=
0
;
}
else
{
...
...
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