Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.5, 10.6, 10.11, 11.1(EOL), 11.2, 11.4, 10.7(EOL), 10.8(EOL), 10.9(EOL), 10.10(EOL), 11.0(EOL), 11.3(EOL), 11.5(EOL)
-
None
Description
I run this script:
CREATE OR REPLACE TABLE t1 (a DATETIME); |
INSERT INTO t1 VALUES ('2001-01-01 10:20:30'); |
CREATE OR REPLACE TABLE t2 AS SELECT AVG(YEAR(a)) FROM t1; |
It unexpectedly returns this error:
ERROR 1264 (22003): Out of range value for column 'AVG(YEAR(a))' at row 2
|
If I add LIMIT 0, the table gets created:
CREATE OR REPLACE TABLE t2 AS SELECT AVG(YEAR(a)) FROM t1 LIMIT 0; |
SHOW CREATE TABLE t2; |
+-------+---------------------------------------------------------------------------------------------------------------------------------+
|
| Table | Create Table |
|
+-------+---------------------------------------------------------------------------------------------------------------------------------+
|
| t2 | CREATE TABLE `t2` (
|
`AVG(YEAR(a))` decimal(7,4) DEFAULT NULL
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci |
|
+-------+---------------------------------------------------------------------------------------------------------------------------------+
|
However, the column size is too small: a DECIMAL(7,4) can store up to 3 integer digits only.
The expected column type is DECIMAL(8,4).
Attachments
Issue Links
- blocks
-
MCOL-5241 MariaDB Columnstore produces wrong averages on extracted null-datetime fields (like year)
- Closed