diff options
author | unknown <Kristofer.Pettersson@naruto.> | 2006-10-02 12:37:01 +0200 |
---|---|---|
committer | unknown <Kristofer.Pettersson@naruto.> | 2006-10-02 12:37:01 +0200 |
commit | 5e71afcbe79091f9113e66e161cb15c3c35f3f67 (patch) | |
tree | 8955a3f30d196b0cff68e0960fc8cacce24207cd /mysql-test/r/func_date_add.result | |
parent | a4b1695376eeb3707fd1f42dc231067209faa58b (diff) | |
download | mariadb-git-5e71afcbe79091f9113e66e161cb15c3c35f3f67.tar.gz |
Bug#21811 Odd casting with date + INTERVAL arithmetic
- Type casting was not consequent, thus when adding a DATE type with
a WEEK interval the result type was DATETIME and not DATE as is the
norm.
- By changing the order of the date internal enumerations the deviant
type casting is resolved (Item_date_add_interval::fix_length_and_dec()
which determines result type for this operation assumes that addition
of any interval with value <= INTERVAL_DAY to date value will result
in date). There are two independant places to change:
interval_names[] and interval_type.
mysql-test/r/func_date_add.result:
Updated result file for type casting test
mysql-test/r/func_time.result:
Updated result file for type casting test
mysql-test/t/func_date_add.test:
Added test for type casting when adding intervals to date.
sql/item_timefunc.cc:
Changed order of "week" key word to match the date interval enumeration.
sql/item_timefunc.h:
Changed the order of the enumeration to better follow interval sizes.
Diffstat (limited to 'mysql-test/r/func_date_add.result')
-rw-r--r-- | mysql-test/r/func_date_add.result | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/mysql-test/r/func_date_add.result b/mysql-test/r/func_date_add.result index 841d13a6ea6..ac5709260fd 100644 --- a/mysql-test/r/func_date_add.result +++ b/mysql-test/r/func_date_add.result @@ -71,3 +71,17 @@ NULL NULL NULL drop table t1; +End of 4.1 tests +SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 DAY; +CAST('2006-09-26' AS DATE) + INTERVAL 1 DAY +2006-09-27 +SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 MONTH; +CAST('2006-09-26' AS DATE) + INTERVAL 1 MONTH +2006-10-26 +SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 YEAR; +CAST('2006-09-26' AS DATE) + INTERVAL 1 YEAR +2007-09-26 +SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 WEEK; +CAST('2006-09-26' AS DATE) + INTERVAL 1 WEEK +2006-10-03 +End of 5.0 tests |