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

Changing delimiter after commented line in mysql client

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 5.5.59, 10.2.12
    • 10.4
    • Scripts & Clients
    • None
    • Debian / Ubuntu

    Description

      Encountered an odd "You have an error in your SQL syntax" error while running a script into mysql client. After making sure there were no obvious errors or typos in our script, I finally found the culprits causing the error.

      Seems like commented lines with white space before the comment mark "--" (or actually also "#") makes the command processing continue until a delimiter is encountered. But if trying to change the delimiter right after such commented line, the delimiter change is not executed and results in syntax error message when ("old") delimiter is finally encountered later.
      Same happens with multi-line comments. There is no difference whether the comment block is actually on multiple lines or on a single line.

      Expected result: DELIMITER command should be executed whether the previous line/command is commented out (with or without white space) or multi-line comment.

      See attached files for a script with working and non-working cases, including workarounds at the end, and results when each segment of commands was executed in mysql client.

      Also tested in Oracle mysql, which seems to behave differently with multi-line comments in that it doesn't require a delimiter after the end of the comment block in order for the delimiter change to work correctly. The white space problem is there as well, although it is not immediately visible if executing the commands just one line at a time.

      Edit: The errors happen when --comments option is given to mysql client (either from command line or having "comments=1" in config file).

      Attachments

        Activity

          People

            Unassigned Unassigned
            juhapyy Juha Pyy
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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