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

Inconsistent behaviors of RAND function

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Not a Bug
    • Affects Version/s: 10.5.12
    • Fix Version/s: N/A
    • Component/s: Data types
    • Labels:
    • Environment:
      OS: Ubuntu-20.04

      Description

      /* init */ create table t(a int);
      /* init */ insert into t values (0), (1), (2);
       
      mariadb> select * from t where rand('test');
      +------+
      | a    |
      +------+
      |    1 |
      |    2 |
      +------+
      2 rows in set, 1 warning (0.01 sec)
       
      mariadb> update t set a = + 1 where rand('test');
      ERROR 1292 (22007): Truncated incorrect INTEGER value: 'test'
      

      The function RAND() with a string type argument has different meanings in SELECT and UPDATE statements, which can cause inconsistent problems.

        Attachments

          Activity

            People

            Assignee:
            serg Sergei Golubchik
            Reporter:
            dinary dinary
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.