[MDEV-17318] CAST(LEAST(zero_date,non_zero_date) AS numeric_data_type) returns a wrong result Created: 2018-09-28  Updated: 2018-09-30  Resolved: 2018-09-30

Status: Closed
Project: MariaDB Server
Component/s: Data types, Temporal Types
Affects Version/s: 10.0, 10.1, 10.2, 10.3, 10.4
Fix Version/s: 10.4.0

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Blocks
blocks MDEV-17317 Add THD* parameter into Item::get_dat... Closed
Relates
relates to MDEV-17330 Wrong result for 0 + LEAST(TIME'-10:0... Closed
relates to MDEV-16991 Rounding vs truncation for TIME, DATE... Closed
relates to MDEV-17329 Inconsistency of NULL date value conv... Open

 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.


Generated at Thu Feb 08 08:35:33 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.