Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-12390

Wrong error line numbers reported with sql_mode=IGNORE_SPACE

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.0, 10.1, 10.2
    • Fix Version/s: 10.2.5
    • Component/s: Parser
    • 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
      

        Attachments

          Activity

            People

            • Assignee:
              bar Alexander Barkov
              Reporter:
              bar Alexander Barkov
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: