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

Warnings on wrong function parameters are not quite accurate

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 10.1, 10.2
    • Fix Version/s: 10.3, 10.4
    • Component/s: Data types
    • Labels:
      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

              • Assignee:
                bar Alexander Barkov
                Reporter:
                elenst Elena Stepanova
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: