Commit d45841b9 authored by Rucha Deodhar's avatar Rucha Deodhar

MDEV-26695: Number of an invalid row is not calculated for table value

constructor

Analysis: counter does not increment while sending rows for table value
constructor and so row_number assumes the default value (0 in this case).
Fix: Increment the counter to avoid counter using default value.
parent 551e7814
......@@ -790,3 +790,13 @@ GET DIAGNOSTICS @var1 = NUMBER;
SHOW STATUS LIKE 'Com%get_diagnostics';
Variable_name Value
Com_get_diagnostics 1
#
# MDEV-26695: Number of an invalid row is not calculated for table value constructor
#
CREATE TABLE t1 (a CHAR(1)) VALUES ('a'),('b'),('foo');
Warnings:
Warning 1406 Data too long for column 'a' at row 3
CREATE TABLE t2 (a char(1)) VALUES ('a'),('b') UNION VALUES ('foo');
Warnings:
Warning 1406 Data too long for column 'a' at row 3
DROP TABLE t1, t2;
......@@ -851,3 +851,12 @@ FLUSH STATUS;
SHOW STATUS LIKE 'Com%get_diagnostics';
GET DIAGNOSTICS @var1 = NUMBER;
SHOW STATUS LIKE 'Com%get_diagnostics';
--echo #
--echo # MDEV-26695: Number of an invalid row is not calculated for table value constructor
--echo #
CREATE TABLE t1 (a CHAR(1)) VALUES ('a'),('b'),('foo');
CREATE TABLE t2 (a char(1)) VALUES ('a'),('b') UNION VALUES ('foo');
DROP TABLE t1, t2;
......@@ -406,9 +406,11 @@ bool table_value_constr::exec(SELECT_LEX *sl)
while ((elem= li++))
{
THD *cur_thd= sl->parent_lex->thd;
if (send_records >= sl->master_unit()->select_limit_cnt)
break;
int rc= result->send_data(*elem);
cur_thd->get_stmt_da()->inc_current_row_for_warning();
if (!rc)
send_records++;
else if (rc > 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment