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

No warning when using IF(string-input) in numeric context

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 5.5.33
    • Fix Version/s: 5.5
    • Component/s: None
    • Labels:
      None

      Description

      This query correctly returns a warning,
      because 'xxx' is not a valid number.

      mysql> select 'xxx'+1;
      +---------+
      | 'xxx'+1 |
      +---------+
      |       1 |
      +---------+
      1 row in set, 1 warning (0.00 sec)
      
      mysql> show warnings;
      +---------+------+-----------------------------------------+
      | Level   | Code | Message                                 |
      +---------+------+-----------------------------------------+
      | Warning | 1292 | Truncated incorrect DOUBLE value: 'xxx' |
      +---------+------+-----------------------------------------+
      1 row in set (0.00 sec)
      

      This query does not produce a warning, which is wrong:

      mysql> select IF(1=1,'xxx','yyy')+1;
      +-----------------------+
      | IF(1=1,'xxx','yyy')+1 |
      +-----------------------+
      |                     1 |
      +-----------------------+
      1 row in set (0.00 sec)
      

        Gliffy Diagrams

          Attachments

            Activity

            There are no comments yet on this issue.

              People

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

                Dates

                • Created:
                  Updated: