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

CAST(LEAST(zero_date,non_zero_date) AS numeric_data_type) returns a wrong result

    Details

      Description

      SET sql_mode='NO_ZERO_DATE,NO_ZERO_IN_DATE';
      SELECT
       LEAST('0000-00-00',DATE'2001-01-01') AS c0,
       CAST(LEAST('0000-00-00',DATE'2001-01-01') AS CHAR) AS string,
       CAST(LEAST('0000-00-00',DATE'2001-01-01') AS DATE) AS date,
       CAST(LEAST('0000-00-00',DATE'2001-01-01') AS DATETIME) AS datetime,
       CAST(LEAST('0000-00-00',DATE'2001-01-01') AS TIME) AS time,
       CAST(LEAST('0000-00-00',DATE'2001-01-01') AS DECIMAL) AS dc,
       CAST(LEAST('0000-00-00',DATE'2001-01-01') AS DOUBLE) AS dbl,
       CAST(LEAST('0000-00-00',DATE'2001-01-01') AS SIGNED) AS sint,
       CAST(LEAST('0000-00-00',DATE'2001-01-01') AS UNSIGNED) AS uint;
      

      *************************** 1. row ***************************
            c0: NULL
        string: NULL
          date: NULL
      datetime: NULL
          time: 00:00:00
            dc: 0
           dbl: 0
          sint: 0
          uint: 0
      

      The expected result is to return NULL for all columns.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: