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
56887241
Commit
56887241
authored
Nov 13, 2002
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge abelkin@work.mysql.com:/home/bk/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/mysql-4.1
parents
d44e3511
224fcb20
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
37 additions
and
17 deletions
+37
-17
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+8
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+10
-1
sql/sql_class.cc
sql/sql_class.cc
+0
-1
sql/sql_lex.h
sql/sql_lex.h
+1
-1
sql/sql_parse.cc
sql/sql_parse.cc
+15
-12
sql/sql_select.cc
sql/sql_select.cc
+3
-2
No files found.
mysql-test/r/subselect.result
View file @
56887241
...
...
@@ -256,4 +256,12 @@ UNIQUE KEY `maxnumrep` (`maxnumrep`)
INSERT INTO forumconthardwarefr7 (numeropost,maxnumrep) VALUES (1,0),(2,1);
select numeropost as a FROM forumconthardwarefr7 GROUP BY (SELECT 1 FROM forumconthardwarefr7 HAVING a=1);
Subselect returns more than 1 record
select numeropost as a FROM forumconthardwarefr7 ORDER BY (SELECT 1 FROM forumconthardwarefr7 HAVING a=1);
Subselect returns more than 1 record
drop table if exists forumconthardwarefr7;
drop table if exists iftest;
CREATE TABLE iftest (field char(1) NOT NULL DEFAULT 'b');
INSERT INTO iftest VALUES ();
SELECT field FROM iftest WHERE 1=(SELECT 1 UNION ALL SELECT 1 FROM (SELECT 1) HAVING field='b');
Subselect returns more than 1 record
drop table iftest;
mysql-test/t/subselect.test
View file @
56887241
...
...
@@ -152,4 +152,13 @@ CREATE TABLE `forumconthardwarefr7` (
INSERT
INTO
forumconthardwarefr7
(
numeropost
,
maxnumrep
)
VALUES
(
1
,
0
),(
2
,
1
);
--
error
1240
select
numeropost
as
a
FROM
forumconthardwarefr7
GROUP
BY
(
SELECT
1
FROM
forumconthardwarefr7
HAVING
a
=
1
);
drop
table
if
exists
forumconthardwarefr7
;
\ No newline at end of file
--
error
1240
select
numeropost
as
a
FROM
forumconthardwarefr7
ORDER
BY
(
SELECT
1
FROM
forumconthardwarefr7
HAVING
a
=
1
);
drop
table
if
exists
forumconthardwarefr7
;
drop
table
if
exists
iftest
;
CREATE
TABLE
iftest
(
field
char
(
1
)
NOT
NULL
DEFAULT
'b'
);
INSERT
INTO
iftest
VALUES
();
--
error
1240
SELECT
field
FROM
iftest
WHERE
1
=
(
SELECT
1
UNION
ALL
SELECT
1
FROM
(
SELECT
1
)
HAVING
field
=
'b'
);
drop
table
iftest
;
sql/sql_class.cc
View file @
56887241
...
...
@@ -873,7 +873,6 @@ bool select_singleval_subselect::send_data(List<Item> &items)
DBUG_ENTER
(
"select_singleval_subselect::send_data"
);
Item_singleval_subselect
*
it
=
(
Item_singleval_subselect
*
)
item
;
if
(
it
->
assigned
()){
thd
->
fatal_error
=
1
;
my_message
(
ER_SUBSELECT_NO_1_ROW
,
ER
(
ER_SUBSELECT_NO_1_ROW
),
MYF
(
0
));
DBUG_RETURN
(
1
);
}
...
...
sql/sql_lex.h
View file @
56887241
...
...
@@ -336,7 +336,7 @@ class st_select_lex: public st_select_lex_node
}
st_select_lex
*
outer_select
();
st_select_lex
*
next_select
()
{
return
(
st_select_lex
*
)
next
;
}
st_select_lex
*
next_select_in_list
()
st_select_lex
*
next_select_in_list
()
{
return
(
st_select_lex
*
)
link_next
;
}
...
...
sql/sql_parse.cc
View file @
56887241
...
...
@@ -1297,7 +1297,7 @@ mysql_execute_command(THD *thd)
that is not a SHOW command or a select that only access local
variables, but for now this is probably good enough.
*/
if
(
tables
)
if
(
tables
||
lex
->
select_lex
.
next_select_in_list
()
)
mysql_reset_errors
(
thd
);
/*
Save old warning count to be able to send to client how many warnings we
...
...
@@ -1334,17 +1334,20 @@ mysql_execute_command(THD *thd)
*/
if
(
lex
->
derived_tables
)
{
for
(
TABLE_LIST
*
cursor
=
tables
;
cursor
;
cursor
=
cursor
->
next
)
if
(
cursor
->
derived
&&
(
res
=
mysql_derived
(
thd
,
lex
,
(
SELECT_LEX_UNIT
*
)
cursor
->
derived
,
cursor
)))
{
if
(
res
<
0
)
send_error
(
thd
,
thd
->
killed
?
ER_SERVER_SHUTDOWN
:
0
);
DBUG_VOID_RETURN
;
}
for
(
SELECT_LEX
*
sl
=
&
lex
->
select_lex
;
sl
;
sl
=
sl
->
next_select_in_list
())
if
(
sl
->
linkage
!=
DERIVED_TABLE_TYPE
)
for
(
TABLE_LIST
*
cursor
=
sl
->
get_table_list
();
cursor
;
cursor
=
cursor
->
next
)
if
(
cursor
->
derived
&&
(
res
=
mysql_derived
(
thd
,
lex
,
(
SELECT_LEX_UNIT
*
)
cursor
->
derived
,
cursor
)))
{
if
(
res
<
0
)
send_error
(
thd
,
thd
->
killed
?
ER_SERVER_SHUTDOWN
:
0
);
DBUG_VOID_RETURN
;
}
}
if
((
lex
->
select_lex
.
next_select_in_list
()
&&
lex
->
unit
.
create_total_list
(
thd
,
lex
,
&
tables
))
||
...
...
sql/sql_select.cc
View file @
56887241
...
...
@@ -994,7 +994,8 @@ JOIN::exec()
}
having
=
having_list
;
// Actually a parameter
thd
->
proc_info
=
"Sending data"
;
error
=
do_select
(
this
,
&
fields_list
,
NULL
,
procedure
);
error
=
thd
->
net
.
report_error
||
do_select
(
this
,
&
fields_list
,
NULL
,
procedure
);
DBUG_VOID_RETURN
;
}
...
...
@@ -1078,7 +1079,7 @@ mysql_select(THD *thd, TABLE_LIST *tables, List<Item> &fields, COND *conds,
goto
err
;
}
if
(
free_join
&&
join
->
global_optimize
(
))
if
(
thd
->
net
.
report_error
||
(
free_join
&&
join
->
global_optimize
()
))
goto
err
;
join
->
exec
();
...
...
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