[MDEV-33198] row number incorrect in warning message created by PROCEDURE Created: 2024-01-08  Updated: 2024-01-08

Status: Confirmed
Project: MariaDB Server
Component/s: Data Definition - Procedure
Affects Version/s: 10.5.16, 10.4, 10.5, 10.6, 10.11, 11.0, 11.1, 11.2, 11.3
Fix Version/s: 10.4, 10.5, 10.6, 10.11, 11.0, 11.1, 11.2, 11.3

Type: Bug Priority: Minor
Reporter: hejieming Assignee: Rucha Deodhar
Resolution: Unresolved Votes: 0
Labels: None
Environment:

CentOS Linux release 7.4.1708


Attachments: PNG File Exceptions.png     PNG File Normal case.png    

 Description   

Reproduction Procedure

Preparation:

  set global sql_mode="";
 
  CREATE TABLE t1 (
    c1 int(11)
  );
 
  DELIMITER // 
  CREATE definer='rdsAdmin'@'localhost' PROCEDURE add_row(IN c1 INT) SQL SECURITY INVOKER body: BEGIN insert into test.t1(c1) values(c1); END ; 
  // 
  DELIMITER ;
 
  call add_row(1); 
  call add_row(2); 
  call add_row(3);

Normal case

  call add_row(2147483648); 
  show warnings;

Exceptions

  select count(1) from t1
  call add_row(2147483648); 
  show warnings;

The row number should be 1 but not.

use gdb to debug, find the variable m_current_row_for_warning is not reset or changed by something else



 Comments   
Comment by Sergei Golubchik [ 2024-01-08 ]

In 10.6 seems to work correctly for me

Comment by Alice Sherepa [ 2024-01-08 ]

Thank you for the report!
It is somehow dependent on the previous select:

CREATE TABLE t1 ( c1 int(11) );
CREATE PROCEDURE add_row(IN c1 INT)  insert  into test.t1(c1) values(c1) ;
 
  call add_row(1); 
  call add_row(2); 
 
--error 1264
call add_row(2147483648);
 
SELECT * from t1;
  --error 1264
call add_row(2147483648);
 
call add_row(3); 
--error 1264
call add_row(2147483648);
 
SELECT * from t1;
  --error 1264
call add_row(2147483648);

CREATE TABLE t1 ( c1 int(11) );
CREATE PROCEDURE add_row(IN c1 INT)  insert into test.t1(c1) values(c1) ;
call add_row(1);
call add_row(2);
call add_row(2147483648);
ERROR 22003: Out of range value for column 'c1' at row 0
SELECT * from t1;
c1
1
2
call add_row(2147483648);
ERROR 22003: Out of range value for column 'c1' at row 3
call add_row(3);
call add_row(2147483648);
ERROR 22003: Out of range value for column 'c1' at row 0
SELECT * from t1;
c1
1
2
3
call add_row(2147483648);
ERROR 22003: Out of range value for column 'c1' at row 4

Also with sql_mode='' - there is a warning 'Out of range value for column 'c1' at row 1', while with the error - it reports row 0.

Generated at Thu Feb 08 10:37:07 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.