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

\W client command does not work well with DELIMITER

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Not a Bug
    • Affects Version/s: 5.1.67, 5.2.14, 5.3.12, 5.5.34, 10.0.7
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      I found this bug adding \W at the beginning of a batch file, but I can write a command-line test case:

      MariaDB [stk_apalog]> \W
      Show warnings enabled.
      MariaDB [stk_apalog]> DELIMITER ||
      MariaDB [stk_apalog]> CREATE DATABASE IF NOT EXISTS test;
          -> DO NULL;
          -> ||
      Query OK, 1 row affected, 1 warning (0.00 sec)
      
      Query OK, 0 rows affected (0.00 sec)
      

      The || delimiter runs 2 statements in this case. If the first statement generates a warning, the warning does not appear. By deleting USE NULL and retrying, the warning appears.

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            elenst Elena Stepanova added a comment -

            I actually see some logic in the current behavior.
            \W is a client option that means "Enable display of warnings after each statement"
            DELIMITER means a separator between statements from the client's point of view.
            Thus, after we set it to a non-';' value, for the client the whole composition of CREATE and DO is a single statement; and when it's fully executed, it produces no warnings.

            However, I"m not sure if it's designed this way or I'm just inventing excuses, so I'll leave it to somebody else to decide.

            Show
            elenst Elena Stepanova added a comment - I actually see some logic in the current behavior. \W is a client option that means "Enable display of warnings after each statement" DELIMITER means a separator between statements from the client's point of view. Thus, after we set it to a non-';' value, for the client the whole composition of CREATE and DO is a single statement; and when it's fully executed, it produces no warnings. However, I"m not sure if it's designed this way or I'm just inventing excuses, so I'll leave it to somebody else to decide.
            Hide
            serg Sergei Golubchik added a comment -

            Expected behavior. \W tells mysql to issue an automatic SHOW WARNINGS every time after sending a statement to the server (and reading its results, if any). In your test case you ask mysql to send two staments at once, in one mysql_real_query() call. There is no way it can squeeze a SHOW WARNINGS in the middle of it.

            Show
            serg Sergei Golubchik added a comment - Expected behavior. \W tells mysql to issue an automatic SHOW WARNINGS every time after sending a statement to the server (and reading its results, if any). In your test case you ask mysql to send two staments at once, in one mysql_real_query() call. There is no way it can squeeze a SHOW WARNINGS in the middle of it.

              People

              • Assignee:
                serg Sergei Golubchik
                Reporter:
                f_razzoli Federico Razzoli
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: