[MDEV-12390] Wrong error line numbers reported with sql_mode=IGNORE_SPACE Created: 2017-03-29  Updated: 2018-06-25  Resolved: 2018-06-21

Status: Closed
Project: MariaDB Server
Component/s: Parser
Affects Version/s: 10.0, 10.1, 10.2
Fix Version/s: 10.2.5

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None


 Description   

If I set sql_mode=IGNORE_SPACE, messages about syntax errors report wrong line numbers:

SET sql_mode=IGNORE_SPACE;
DROP PROCEDURE IF EXISTS p1;
DELIMITER $$
CREATE PROCEDURE p1()
BEGIN
  SELECT 1+1;
  syntax error;
END;
$$
DELIMITER ;

ERROR 1064 (42000): You have an error in your SQL syntax ... near 'error...' at line 3

Notice, the line number 3 is wrong. The syntax error is actually on the line 4.

If I change to sql_mode=DEFAULT, it correctly reports 'at line 4':

SET sql_mode=DEFAULT;
DROP PROCEDURE IF EXISTS p1;
DELIMITER $$
CREATE PROCEDURE p1()
BEGIN
  SELECT 1+1;
  syntax error;
END;
$$
DELIMITER ;

ERROR 1064 (42000): You have an error in your SQL syntax ... near 'error...' at line 4



 Comments   
Comment by Alexander Barkov [ 2017-03-29 ]

Jerome Brauge reported the problem and contributes a patch fixing the problem.

Comment by Jérôme Brauge [ 2017-03-29 ]

Alexander, I share the code of this patch under terms of MCA.
Regards.

Comment by Alexander Barkov [ 2018-06-21 ]

Forgot to close the task. It was pushed to 10.2 on 29 Mar 2017 and released in 10.2.5 on 5 Apr 2017 .

Comment by Alexander Barkov [ 2018-06-25 ]

julien.fritsch It was fixed in 10.2.5 on Wed Mar 29, 2017. It was not fixed in earlier version.

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