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

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

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 5.5.33
    • 5.5
    • None
    • 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)

      Attachments

        Activity

          People

            bar Alexander Barkov
            bar Alexander Barkov
            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.