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

Wrong error line numbers reported with sql_mode=IGNORE_SPACE

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.0(EOL), 10.1(EOL), 10.2(EOL)
    • 10.2.5
    • Parser
    • 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

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

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.