mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
Fixed bug mdev-4918.
The function SELECT_LEX::mark_const_derived() must take into account that in DELETE ... RETURNING join == NULL.
This commit is contained in:
parent
f0deff867a
commit
7c85205d19
3 changed files with 25 additions and 1 deletions
|
@ -233,3 +233,13 @@ DROP USER mysqltest_1@localhost;
|
|||
DROP VIEW v1;
|
||||
DROP TABLE t1,t2;
|
||||
DROP TABLE t1c,t2c;
|
||||
#
|
||||
# Bug mdev-4918: DELETE ... RETURNING subquery with more than 1 row
|
||||
#
|
||||
CREATE TABLE t1 (i1 int);
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
CREATE TABLE t2 (i2 int);
|
||||
INSERT INTO t2 VALUES (1),(2);
|
||||
DELETE FROM t1 ORDER BY i1 RETURNING ( SELECT i2 FROM t2 );
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
DROP TABLE t1,t2;
|
||||
|
|
|
@ -186,4 +186,17 @@ DROP VIEW v1;
|
|||
DROP TABLE t1,t2;
|
||||
DROP TABLE t1c,t2c;
|
||||
|
||||
--echo #
|
||||
--echo # Bug mdev-4918: DELETE ... RETURNING subquery with more than 1 row
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (i1 int);
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
|
||||
CREATE TABLE t2 (i2 int);
|
||||
INSERT INTO t2 VALUES (1),(2);
|
||||
|
||||
--error ER_SUBQUERY_NO_1_ROW
|
||||
DELETE FROM t1 ORDER BY i1 RETURNING ( SELECT i2 FROM t2 );
|
||||
|
||||
DROP TABLE t1,t2;
|
|
@ -4085,7 +4085,8 @@ void SELECT_LEX::increase_derived_records(ha_rows records)
|
|||
void SELECT_LEX::mark_const_derived(bool empty)
|
||||
{
|
||||
TABLE_LIST *derived= master_unit()->derived;
|
||||
if (!join->thd->lex->describe && derived)
|
||||
/* join == NULL in DELETE ... RETURNING */
|
||||
if (!(join && join->thd->lex->describe) && derived)
|
||||
{
|
||||
if (!empty)
|
||||
increase_derived_records(1);
|
||||
|
|
Loading…
Add table
Reference in a new issue