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

Warnings on wrong function parameters are not quite accurate

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 10.1(EOL), 10.2(EOL)
    • 10.4(EOL)
    • Data types
    • None

    Description

      MySQL produces better-looking warnings upon wrong function parameters.
      Please also note that at least in this case it produces them regardless of the sql_mode.

      MariaDB 10.2

      MariaDB [test]> set sql_mode='';
      Query OK, 0 rows affected (0.00 sec)
       
      MariaDB [test]> select log(-1);
      +---------+
      | log(-1) |
      +---------+
      |    NULL |
      +---------+
      1 row in set (0.00 sec)
       
      MariaDB [test]> set sql_mode='ERROR_FOR_DIVISION_BY_ZERO';
      Query OK, 0 rows affected (0.00 sec)
       
      MariaDB [test]> select log(-1);
      +---------+
      | log(-1) |
      +---------+
      |    NULL |
      +---------+
      1 row in set, 1 warning (0.00 sec)
       
      MariaDB [test]> show warnings;
      +---------+------+---------------+
      | Level   | Code | Message       |
      +---------+------+---------------+
      | Warning | 1365 | Division by 0 |
      +---------+------+---------------+
      1 row in set (0.00 sec)
      

      MySQL 5.7

      MySQL [test]> set sql_mode='';
      Query OK, 0 rows affected (0.00 sec)
       
      MySQL [test]> select log(-1);
      +---------+
      | log(-1) |
      +---------+
      |    NULL |
      +---------+
      1 row in set, 1 warning (0.00 sec)
       
      MySQL [test]> show warnings;
      +---------+------+--------------------------------+
      | Level   | Code | Message                        |
      +---------+------+--------------------------------+
      | Warning | 3020 | Invalid argument for logarithm |
      +---------+------+--------------------------------+
      1 row in set (0.01 sec)
       
      MySQL [test]> set sql_mode='ERROR_FOR_DIVISION_BY_ZERO';
      Query OK, 0 rows affected, 1 warning (0.00 sec)
       
      MySQL [test]> select log(-1);
      +---------+
      | log(-1) |
      +---------+
      |    NULL |
      +---------+
      1 row in set, 1 warning (0.00 sec)
       
      MySQL [test]> show warnings;
      +---------+------+--------------------------------+
      | Level   | Code | Message                        |
      +---------+------+--------------------------------+
      | Warning | 3020 | Invalid argument for logarithm |
      +---------+------+--------------------------------+
      1 row in set (0.00 sec)
      

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.