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
910245be
Commit
910245be
authored
Nov 18, 2002
by
Sinisa@sinisa.nasamreza.org
Browse files
Options
Browse Files
Download
Plain Diff
Merge sinisa@work.mysql.com:/home/bk/mysql-4.1
into sinisa.nasamreza.org:/mnt/work/mysql-4.1
parents
d7344d9f
9e15fe17
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
7 deletions
+14
-7
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+2
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+2
-1
sql/sql_select.cc
sql/sql_select.cc
+10
-6
No files found.
mysql-test/r/subselect.result
View file @
910245be
...
@@ -279,6 +279,8 @@ UNIQUE KEY `numreponse` (`numreponse`),
...
@@ -279,6 +279,8 @@ UNIQUE KEY `numreponse` (`numreponse`),
KEY `pseudo` (`pseudo`,`numeropost`)
KEY `pseudo` (`pseudo`,`numeropost`)
) TYPE=MyISAM;
) TYPE=MyISAM;
INSERT INTO threadhardwarefr7 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
INSERT INTO threadhardwarefr7 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
EXPLAIN SELECT numreponse FROM threadhardwarefr7 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM threadhardwarefr7 WHERE numeropost='1');
Subselect returns more than 1 record
EXPLAIN SELECT MAX(numreponse) FROM threadhardwarefr7 WHERE numeropost='1';
EXPLAIN SELECT MAX(numreponse) FROM threadhardwarefr7 WHERE numeropost='1';
id select_type table type possible_keys key key_len ref rows Extra
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE Select tables optimized away
1 SIMPLE Select tables optimized away
...
...
mysql-test/t/subselect.test
View file @
910245be
...
@@ -177,7 +177,8 @@ CREATE TABLE `threadhardwarefr7` (
...
@@ -177,7 +177,8 @@ CREATE TABLE `threadhardwarefr7` (
KEY
`pseudo`
(
`pseudo`
,
`numeropost`
)
KEY
`pseudo`
(
`pseudo`
,
`numeropost`
)
)
TYPE
=
MyISAM
;
)
TYPE
=
MyISAM
;
INSERT
INTO
threadhardwarefr7
(
numeropost
,
numreponse
,
pseudo
)
VALUES
(
1
,
1
,
'joce'
),(
1
,
2
,
'joce'
),(
1
,
3
,
'test'
);
INSERT
INTO
threadhardwarefr7
(
numeropost
,
numreponse
,
pseudo
)
VALUES
(
1
,
1
,
'joce'
),(
1
,
2
,
'joce'
),(
1
,
3
,
'test'
);
--
error
1240
EXPLAIN
SELECT
numreponse
FROM
threadhardwarefr7
WHERE
numeropost
=
'1'
AND
numreponse
=
(
SELECT
1
FROM
threadhardwarefr7
WHERE
numeropost
=
'1'
);
EXPLAIN
SELECT
MAX
(
numreponse
)
FROM
threadhardwarefr7
WHERE
numeropost
=
'1'
;
EXPLAIN
SELECT
MAX
(
numreponse
)
FROM
threadhardwarefr7
WHERE
numeropost
=
'1'
;
EXPLAIN
SELECT
numreponse
FROM
threadhardwarefr7
WHERE
numeropost
=
'1'
AND
numreponse
=
(
SELECT
MAX
(
numreponse
)
FROM
threadhardwarefr7
WHERE
numeropost
=
'1'
);
EXPLAIN
SELECT
numreponse
FROM
threadhardwarefr7
WHERE
numeropost
=
'1'
AND
numreponse
=
(
SELECT
MAX
(
numreponse
)
FROM
threadhardwarefr7
WHERE
numeropost
=
'1'
);
drop
table
if
exists
threadhardwarefrtest7
;
drop
table
if
exists
threadhardwarefrtest7
;
sql/sql_select.cc
View file @
910245be
...
@@ -372,13 +372,17 @@ JOIN::optimize()
...
@@ -372,13 +372,17 @@ JOIN::optimize()
}
}
#endif
#endif
conds
=
optimize_cond
(
conds
,
&
cond_value
);
conds
=
optimize_cond
(
conds
,
&
cond_value
);
if
(
thd
->
fatal_error
||
thd
->
net
.
report_error
)
if
(
thd
->
fatal_error
)
{
{
// quick abort
delete
procedure
;
delete
procedure
;
error
=
0
;
error
=
0
;
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
}
}
else
if
(
thd
->
net
.
report_error
)
// normal error processing & cleanup
DBUG_RETURN
(
-
1
);
if
(
cond_value
==
Item
::
COND_FALSE
||
(
!
unit
->
select_limit_cnt
&&
!
(
select_options
&
OPTION_FOUND_ROWS
)))
if
(
cond_value
==
Item
::
COND_FALSE
||
(
!
unit
->
select_limit_cnt
&&
!
(
select_options
&
OPTION_FOUND_ROWS
)))
{
/* Impossible cond */
{
/* Impossible cond */
zero_result_cause
=
"Impossible WHERE"
;
zero_result_cause
=
"Impossible WHERE"
;
...
@@ -7520,8 +7524,8 @@ int mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result)
...
@@ -7520,8 +7524,8 @@ int mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result)
break
;
break
;
}
}
if
(
res
>
0
)
if
(
res
>
0
||
thd
->
net
.
report_error
)
res
=
-
res
;
// mysql_explain_select do not report error
res
=
-
1
;
// mysql_explain_select do not report error
DBUG_RETURN
(
res
);
DBUG_RETURN
(
res
);
}
}
...
...
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