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

Inconsistent behaviors of RAND function

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.5.12
    • Fix Version/s: None
    • 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:
            Unassigned Unassigned
            Reporter:
            dinary dinary
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Git Integration