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
2cb4abb5
Commit
2cb4abb5
authored
Nov 15, 2003
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed error handling inside su_select() for multidelete
(BUG#1839)
parent
f4d7afd2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
3 deletions
+51
-3
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+29
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+19
-1
sql/sql_select.cc
sql/sql_select.cc
+3
-2
No files found.
mysql-test/r/subselect.result
View file @
2cb4abb5
...
@@ -1569,3 +1569,32 @@ INSERT INTO t2 VALUES (100, 200, 'C');
...
@@ -1569,3 +1569,32 @@ INSERT INTO t2 VALUES (100, 200, 'C');
SELECT DISTINCT COLC FROM t1 WHERE COLA = (SELECT COLA FROM t2 WHERE COLB = 200 AND COLC ='C' LIMIT 1);
SELECT DISTINCT COLC FROM t1 WHERE COLA = (SELECT COLA FROM t2 WHERE COLB = 200 AND COLC ='C' LIMIT 1);
COLC
COLC
DROP TABLE t1, t2;
DROP TABLE t1, t2;
create table t11 (a int NOT NULL, b int, primary key (a));
create table t12 (a int NOT NULL, b int, primary key (a));
create table t2 (a int NOT NULL, b int, primary key (a));
insert into t11 values (0, 10),(1, 11),(2, 12);
insert into t12 values (33, 10),(22, 11),(2, 12);
insert into t2 values (1, 21),(2, 12),(3, 23);
select * from t11;
a b
0 10
1 11
2 12
select * from t12;
a b
33 10
22 11
2 12
select * from t2;
a b
1 21
2 12
3 23
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b > (select b from t2);
ERROR 21000: Subquery returns more than 1 row
select * from t2;
a b
1 21
2 12
3 23
drop table t11, t12, t2;
mysql-test/t/subselect.test
View file @
2cb4abb5
...
@@ -1008,4 +1008,22 @@ CREATE TABLE t2(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC CHAR(1) NOT NULL,PR
...
@@ -1008,4 +1008,22 @@ CREATE TABLE t2(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC CHAR(1) NOT NULL,PR
INSERT
INTO
t1
VALUES
(
1
,
1
,
'1A3240'
),
(
1
,
2
,
'4W2365'
);
INSERT
INTO
t1
VALUES
(
1
,
1
,
'1A3240'
),
(
1
,
2
,
'4W2365'
);
INSERT
INTO
t2
VALUES
(
100
,
200
,
'C'
);
INSERT
INTO
t2
VALUES
(
100
,
200
,
'C'
);
SELECT
DISTINCT
COLC
FROM
t1
WHERE
COLA
=
(
SELECT
COLA
FROM
t2
WHERE
COLB
=
200
AND
COLC
=
'C'
LIMIT
1
);
SELECT
DISTINCT
COLC
FROM
t1
WHERE
COLA
=
(
SELECT
COLA
FROM
t2
WHERE
COLB
=
200
AND
COLC
=
'C'
LIMIT
1
);
DROP
TABLE
t1
,
t2
;
s
DROP
TABLE
t1
,
t2
;
#
# errors handling
#
create
table
t11
(
a
int
NOT
NULL
,
b
int
,
primary
key
(
a
));
create
table
t12
(
a
int
NOT
NULL
,
b
int
,
primary
key
(
a
));
create
table
t2
(
a
int
NOT
NULL
,
b
int
,
primary
key
(
a
));
insert
into
t11
values
(
0
,
10
),(
1
,
11
),(
2
,
12
);
insert
into
t12
values
(
33
,
10
),(
22
,
11
),(
2
,
12
);
insert
into
t2
values
(
1
,
21
),(
2
,
12
),(
3
,
23
);
select
*
from
t11
;
select
*
from
t12
;
select
*
from
t2
;
--
error
1241
delete
t11
.*
,
t12
.*
from
t11
,
t12
where
t11
.
a
=
t12
.
a
and
t11
.
b
>
(
select
b
from
t2
);
select
*
from
t2
;
drop
table
t11
,
t12
,
t2
;
sql/sql_select.cc
View file @
2cb4abb5
...
@@ -5590,6 +5590,7 @@ sub_select(JOIN *join,JOIN_TAB *join_tab,bool end_of_records)
...
@@ -5590,6 +5590,7 @@ sub_select(JOIN *join,JOIN_TAB *join_tab,bool end_of_records)
int
error
;
int
error
;
bool
found
=
0
;
bool
found
=
0
;
COND
*
on_expr
=
join_tab
->
on_expr
,
*
select_cond
=
join_tab
->
select_cond
;
COND
*
on_expr
=
join_tab
->
on_expr
,
*
select_cond
=
join_tab
->
select_cond
;
my_bool
*
report_error
=
&
(
join
->
thd
->
net
.
report_error
);
if
(
!
(
error
=
(
*
join_tab
->
read_first_record
)(
join_tab
)))
if
(
!
(
error
=
(
*
join_tab
->
read_first_record
)(
join_tab
)))
{
{
...
@@ -5628,9 +5629,9 @@ sub_select(JOIN *join,JOIN_TAB *join_tab,bool end_of_records)
...
@@ -5628,9 +5629,9 @@ sub_select(JOIN *join,JOIN_TAB *join_tab,bool end_of_records)
else
else
info
->
file
->
unlock_row
();
info
->
file
->
unlock_row
();
}
}
}
while
(
!
(
error
=
info
->
read_record
(
info
)));
}
while
(
!
(
error
=
info
->
read_record
(
info
))
&&
!
(
*
report_error
)
);
}
}
if
(
error
>
0
)
// Fatal error
if
(
error
>
0
||
(
*
report_error
)
)
// Fatal error
return
-
1
;
return
-
1
;
if
(
!
found
&&
on_expr
)
if
(
!
found
&&
on_expr
)
...
...
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