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

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.0(EOL), 10.1(EOL), 10.2(EOL), 10.3(EOL), 10.4(EOL)
    • 10.4.0
    • Data types, Temporal Types
    • None

    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

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.