summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.cc
diff options
context:
space:
mode:
authorKristofer.Pettersson@naruto. <>2006-10-02 12:37:01 +0200
committerKristofer.Pettersson@naruto. <>2006-10-02 12:37:01 +0200
commit887f3b9d420ba6e2bb38bd5ddefc9e7d125a9810 (patch)
tree8955a3f30d196b0cff68e0960fc8cacce24207cd /sql/item_timefunc.cc
parent5a912955d53ffd18c18cc0d0552c53955f6eabf0 (diff)
downloadmariadb-git-887f3b9d420ba6e2bb38bd5ddefc9e7d125a9810.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.
Diffstat (limited to 'sql/item_timefunc.cc')
-rw-r--r--sql/item_timefunc.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 30230005f6e..f3d7ff2dbdc 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -2151,11 +2151,15 @@ bool Item_date_add_interval::eq(const Item *item, bool binary_cmp) const
(date_sub_interval == other->date_sub_interval));
}
+/*
+ 'interval_names' reflects the order of the enumeration interval_type.
+ See item_timefunc.h
+ */
static const char *interval_names[]=
{
- "year", "quarter", "month", "day", "hour",
- "minute", "week", "second", "microsecond",
+ "year", "quarter", "month", "week", "day",
+ "hour", "minute", "second", "microsecond",
"year_month", "day_hour", "day_minute",
"day_second", "hour_minute", "hour_second",
"minute_second", "day_microsecond",