[MDEV-26841] ROW_NUMBER is not set and differs from the message upon ER_WRONG_VALUE_COUNT_ON_ROW for the 1st row Created: 2021-10-15  Updated: 2021-10-26  Resolved: 2021-10-20

Status: Closed
Project: MariaDB Server
Component/s: Data Manipulation - Insert
Affects Version/s: N/A
Fix Version/s: 10.7.1

Type: Bug Priority: Critical
Reporter: Elena Stepanova Assignee: Rucha Deodhar
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Problem/Incident
is caused by MDEV-10075 Provide index of error causing error ... Closed

 Description   

create or replace table t (a int);
insert into t values (1,2),(3);
 
get diagnostics condition 1 @n= row_number, @m= message_text;
select @n, @m;

bb-10.7-row_number cb9002bee

MariaDB [test]> select @n, @m;
+------+-------------------------------------------------+
| @n   | @m                                              |
+------+-------------------------------------------------+
|    0 | Column count doesn't match value count at row 1 |
+------+-------------------------------------------------+
1 row in set (0.001 sec)

If, however, the error occurs on the 2nd or further rows, ROW_NUMBER is set all right:

MariaDB [test]> insert into t values (1),(2,3);
ERROR 1136 (21S01): Column count doesn't match value count at row 2
MariaDB [test]> get diagnostics condition 1 @n= row_number, @m= message_text;
Query OK, 0 rows affected (0.000 sec)
 
MariaDB [test]> select @n, @m;
+------+-------------------------------------------------+
| @n   | @m                                              |
+------+-------------------------------------------------+
|    2 | Column count doesn't match value count at row 2 |
+------+-------------------------------------------------+
1 row in set (0.001 sec)



 Comments   
Comment by Rucha Deodhar [ 2021-10-17 ]

Patch: https://github.com/MariaDB/server/commit/a1e5bdf87f50cd1f03c889a4be61ecef2da8f526

Comment by Sergei Golubchik [ 2021-10-18 ]

a1e5bdf87f50cd1f03c889a4be61ecef2da8f526 is good,
but please add a second test case. You've added reset_current_row_for_warning(1 in two places. Make sure they're both tested.
Then ok to push

Comment by Rucha Deodhar [ 2021-10-19 ]

Added test and pushed to bb-10.7-row_number

Generated at Thu Feb 08 09:48:22 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.