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

Mathematical Operators Behavior with Strings Is Not Documented

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 10.6.24
    • 10.6
    • OTHER
    • None

    Description

      The behavior of the operators when used with string operands is not documented.

      Test Case

      let $l1 = $('a' || 1);
      --echo ('a' || 1) -> $l1;
      

      mysqltest output:

      mysqltest: At line 1: Type error: operator '||' requires integer operands
      

      Server output:

      MariaDB [(none)]> select 'a' || 1;
      +----------+
      | 'a' || 1 |
      +----------+
      |        1 |
      +----------+
      

      TC2 :

      Test Case

      let $m60 = $(5 + '5');
      -- echo 5 + '5' -> $m60;                            # 55 or error (depends on coercion rules
      

      mysqltest output:

      mysqltest: At line 178: Type error: operator '+' requires integer operands
      

      Server output:

      MariaDB [(none)]> select 5 + '5';
      +---------+
      | 5 + '5' |
      +---------+
      |      10 |
      +---------+
      1 row in set (0.001 sec)
      

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              poojalamba16 Pooja Rani Lamba
              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.