Commit graph

482 commits

Author SHA1 Message Date
Sergei Golubchik
3ff0801c73 MDEV-16810 AddressSanitizer: stack-buffer-overflow in int10_to_str
truncate incorrect values in convert_period_to_month() so that
PERIOD_DIFF never returns a value outside of 2^23 range.

And, for safety, increase buffer sizes for int10_to_str
to be sufficienly big for any int10_to_str result.
2018-08-11 12:19:46 +02:00
Alexander Barkov
c2509a1588 MDEV-13972 crash in Item_func_sec_to_time::get_date 2017-10-10 10:35:12 +04:00
Alexander Barkov
e30b6a983f MDEV-11819 NO_ZERO_IN_DATE: Incorrect generated column value 2017-10-06 18:23:40 +04:00
Alexander Barkov
2f6fede8d5 MDEV-10524 Assertion `arg1_int >= 0' failed in Item_func_additive_op::result_precision()
This change is a backport from 10.0 to 5.5 for:
1. The full patch for:
     MDEV-4841 Wrong character set of ADDTIME() and DATE_ADD()
     9adb6e991e

2. A small fragment of:
     MDEV-5298 Illegal mix of collations on timestamp
     03f6778d61
   which overrides Item_temporal_hybrid_func::cmp_type(),
   and adds a new line into cache_temporal_4265.result.
2016-12-19 14:28:08 +04:00
Sergei Golubchik
f3444df415 Merge branch 'mysql/5.5' into 5.5
reverted about half of commits as either not applicable or
outright wrong
2016-02-09 11:27:40 +01:00
Sreeharsha Ramanavarapu
cb15cce746 Bug #21564557: INCONSISTENT OUTPUT FROM 5.5 AND 5.6
UNIX_TIMESTAMP(STR_TO_DATE('201506', "%Y%M"

Issue:
-----
When an invalid date is supplied to the UNIX_TIMESTAMP
function from STR_TO_DATE, no check is performed before
converting it to a timestamp value.

SOLUTION:
---------
Add the check_date function and only if it succeeds,
proceed to the timestamp conversion.

No warning will be returned for dates having zero in
month/date, since partial dates are allowed. UNIX_TIMESTAMP
will return only a zero for such values.

The problem has been handled in 5.6+ with WL#946.
2015-12-31 07:31:12 +05:30
Alexander Barkov
357cb12d87 DEV-7221 from_days fails after null value 2014-12-16 15:33:13 +04:00
Sergei Golubchik
4b4de01fae 5.3 merge 2014-08-01 16:51:12 +02:00
Sergei Golubchik
681fbcaf92 fix func_time.test to be independent from the system time zone 2014-08-01 12:04:55 +02:00
Alexander Barkov
5b452ae027 MDEV-4511 Assertion `scale <= precision' fails on GROUP BY TIMEDIFF with incorrect types
MDEV-6302 Wrong result set when using GROUP BY FROM_UNIXTIME(...)+0
Fixed.
2014-07-28 13:47:55 +04:00
Alexander Barkov
07cb53c58b Merge 5.3->5.5 2014-07-23 14:59:23 +04:00
Alexander Barkov
80708da138 MDEV-5750 Assertion `ltime->year == 0' fails on a query with EXTRACT DAY_MINUTE and TIME column
Item_func_min_max::get_date() did not clear ltime->year when returning a TIME value.
2014-07-23 13:38:48 +04:00
Alexander Barkov
284479c085 Merge 5.3->5.5 2014-06-04 21:53:15 +04:00
Alexander Barkov
661daf16f1 MDEV-4858 Wrong results for a huge unsigned value inserted into a TIME column
MDEV-6099 Bad results for DATE_ADD(.., INTERVAL 2000000000000000000.0 SECOND)
MDEV-6097 Inconsistent results for CAST(int,decimal,double AS DATETIME)
MDEV-6100 No warning on CAST(9000000 AS TIME)
2014-06-04 20:32:57 +04:00
Alexander Barkov
7ea9d1e692 MDEV-5458 RQG hits 'sql/tztime.cc:799: my_time_t sec_since_epoch(...):
Assertion `mon > 0 && mon < 13' failed.'
2014-01-27 13:15:40 +04:00
Alexander Barkov
0ad8eaeb56 Merge 5.3 -> 5.5 2014-01-27 15:05:23 +04:00
Alexander Barkov
ba3d0b173a Merge 5.3 -> 5.5 2014-01-27 13:14:00 +04:00
Alexander Barkov
d106dc0597 MDEV-5504 Server crashes in String::length on SELECT with MONTHNAME, GROUP BY, ROLLUP
The crash happened because Item_func_monthname was derived from
Item_func_month, so Item_func_monthname::is_null() did not work fine.
Backporting a change from 5.5: Item_func_monthname is now derived from
Item_str_func.
2014-01-24 16:50:39 +04:00
Alexander Barkov
b97b9536c7 MDEV-4857 Wrong result of HOUR('1 00:00:00')
modified:
  mysql-test/r/func_time.result
  mysql-test/t/func_time.test
  sql-common/my_time.c
  sql/item_func.h
  sql/item_timefunc.cc
  sql/mysql_priv.h
  sql/time.cc
2013-12-02 15:09:34 +04:00
Alexander Barkov
5a8bd446ad Merge 5.3->5.5
pending merges:
  Alexander Barkov 2013-12-02 MDEV-4857 Wrong result of HOUR('1 00:00:00')
2013-12-02 15:50:35 +04:00
Alexander Barkov
b20deca695 Merge from 5.3 2013-09-16 14:08:43 +04:00
Alexander Barkov
5464e904b6 MDEV-4861 TIME/DATETIME arithmetics does not preserve INTERVAL precision
Adding tests only.

The problem was earlier fixed by 
MDEV-4724 Some temporal functions do not preserve microseconds
2013-09-16 14:07:01 +04:00
Alexander Barkov
6a5f07ee87 Merge from 5.3
pending merges:
  Alexander Barkov 2013-09-16 MDEV-4870 Wrong values of CASE, COALESCE, IF...
2013-09-16 13:54:12 +04:00
Alexander Barkov
22c4a24961 MDEV-4870 Wrong values of CASE, COALESCE, IFNULL on a combination of different temporal types
Adding test cases from the bug report only.

The problem was earlier fixed by:
MDEV-4863 COALESCE(time_or_datetime) returns wrong results in numeric context

modified:
  mysql-test/r/func_time.result
  mysql-test/t/func_time.test
2013-09-16 13:52:13 +04:00
Alexander Barkov
f2737b415e Merge from 5.3
pending merges:
  Alexander Barkov 2013-09-16 MDEV-4869 Wrong result of MAKETIME(0, 0, -0.1)
2013-09-16 13:08:19 +04:00
Alexander Barkov
6c9d983287 MDEV-4869 Wrong result of MAKETIME(0, 0, -0.1)
Adding a test case only.

The problem was fixed by:

  MDEV-4724 Some temporal functions do not preserve microseconds

modified:
  mysql-test/r/func_time.result
  mysql-test/t/func_time.test
2013-09-16 13:03:49 +04:00
Alexander Barkov
2624022b53 Merge from 5.3
pending merges:
  Alexander Barkov 2013-09-16 MDEV-4843 Wrong data type for TIMESTAMP('200...
2013-09-16 10:51:03 +04:00
Alexander Barkov
5d7b97b89e MDEV-4843 Wrong data type for TIMESTAMP('2001-01-01','10:10:10') 2013-09-16 10:14:41 +04:00
Alexander Barkov
cf9cc19e91 MDEV-4724 Some temporal functions do not preserve microseconds 2013-09-13 14:43:10 +04:00
Alexander Barkov
51dcf4dcff Merge from 5.3.
pending merges:
  Alexander Barkov 2013-09-12 MDEV-4724 Some temporal functions do not pre...
2013-09-13 12:06:17 +04:00
Alexander Barkov
499ddea576 MDEV-4724 Some temporal functions do not preserve microseconds 2013-09-12 21:31:14 +04:00
Alexander Barkov
8b5da9f73b Merge from 5.3
pending merges:
  Alexander Barkov 2013-09-09 MDEV-4863 COALESCE(time_or_datetime) returns...
2013-09-10 10:08:11 +04:00
Alexander Barkov
c2b38529a9 MDEV-4863 COALESCE(time_or_datetime) returns wrong results in numeric context 2013-09-09 15:32:25 +04:00
Alexander Barkov
7cc7710679 Merging MDEV-4635 from 5.3.
Also, fixing a bug in STR_TO_DATE(). It erroneously returned
error in strict mode for dates like '0000-01-01'
(zero year, but non-zero month and day).

According to the manual:
- NO_ZERO_DATE disallows 0000-00-00 (all date parts are zeros)
- NO_ZERO_IN_DATE disallows zero month (YYYY-00-DD) or day (YYYY-MM-00).

0000-01-01 is a valid date, even in strict mode.


modified:
  mysql-test/r/func_time.result
  mysql-test/r/strict.result
  mysql-test/t/func_time.test
  mysql-test/t/strict.test
  sql/item_timefunc.cc
  sql/sql_time.h
pending merges:
  Alexander Barkov 2013-06-17 MDEV-4635 Crash in UNIX_TIMESTAMP(STR_TO_DAT...
2013-06-18 13:14:46 +04:00
Alexander Barkov
4085836acf MDEV-4635 Crash in UNIX_TIMESTAMP(STR_TO_DATE('2020','%Y'))
modified:
  mysql-test/r/func_time.result
  mysql-test/t/func_time.test
  sql/item_timefunc.cc
  sql/mysql_priv.h
2013-06-17 19:25:55 +04:00
Sergei Golubchik
6599fd3e9c 5.3 merge 2013-03-27 10:03:28 +01:00
Sergei Golubchik
1be4295617 MDEV-4293 Valgrind warnings (Conditional jump or move depends on uninitialised value) in remove_eq_conds on time functions with NULL argument
val_int() is expected to return 0 for NULL's
2013-03-20 16:13:00 +01:00
Sergei Golubchik
59408093d1 5.3 merge 2012-08-31 14:15:52 +02:00
Sergei Golubchik
0536c506ff MDEV-437 Microseconds: In time functions precision is calculated modulo 256
store the precision in uint, not uint8
2012-08-30 09:05:27 +02:00
Sergei Golubchik
a3073ecd96 merge 2012-04-05 23:07:18 +02:00
Sergei Golubchik
dea3544b2d mysql-5.1.62 merge 2012-04-05 10:49:38 +02:00
Sergei Golubchik
4933d21e5d merge with mysql-5.5.21 2012-03-09 08:06:59 +01:00
Alexander Barkov
c0badf88c6 Merging BUG#13458237 from 5.1. 2012-01-24 13:24:05 +04:00
Alexander Barkov
b68dca488a Merging BUG#13458237 from 5.1. 2012-01-24 13:24:05 +04:00
Alexander Barkov
f8e924b467 BUG#13458237 - INCONSISTENT HANDLING OF INVALIDE DATES WITH ZERO DAY. SIMILAR TO '2009-10-00'
- Reverting the patch for Bug # 12584302
  The patch will be reverted in 5.1 and 5.5.
  The patch will not be reverted in 5.6, the change will
  be properly documented in 5.6.
- Backporting DBUG_ASSERT not to crash on '0000-01-00'
  (already fixed in mysql-trunk (5.6))
2012-01-24 13:00:13 +04:00
Alexander Barkov
1f776e9f24 BUG#13458237 - INCONSISTENT HANDLING OF INVALIDE DATES WITH ZERO DAY. SIMILAR TO '2009-10-00'
- Reverting the patch for Bug # 12584302
  The patch will be reverted in 5.1 and 5.5.
  The patch will not be reverted in 5.6, the change will
  be properly documented in 5.6.
- Backporting DBUG_ASSERT not to crash on '0000-01-00'
  (already fixed in mysql-trunk (5.6))
2012-01-24 13:00:13 +04:00
Alexander Barkov
1522923949 BUG#13354387 - CRASH IN IN MY_DECIMAL::OPERATOR FOR VIEW AND FUNCTION UNIX_TIME
Fixing the 5.5 part (the 5.6 part will go in a separate commit soon).

Problem:
  Item_direct_ref::get_date() incorrectly calculated its "null_value",
  which made UNIX_TIMESTAMP(view_column) incorrectly return NULL
  for a NOT NULL view_column.

Fix:
  Make Item_direct_ref::get_date() calculate null_value
  in the similar way with the other methods 
  (val_real,val_str,val_int,val_decimal):
  copy null_value from the referenced Item.

modified:
  mysql-test/r/func_time.result
  mysql-test/t/func_time.test
  sql/item.cc
2012-01-12 13:02:51 +04:00
Alexander Barkov
cbee6f82b9 BUG#13354387 - CRASH IN IN MY_DECIMAL::OPERATOR FOR VIEW AND FUNCTION UNIX_TIME
Fixing the 5.5 part (the 5.6 part will go in a separate commit soon).

Problem:
  Item_direct_ref::get_date() incorrectly calculated its "null_value",
  which made UNIX_TIMESTAMP(view_column) incorrectly return NULL
  for a NOT NULL view_column.

Fix:
  Make Item_direct_ref::get_date() calculate null_value
  in the similar way with the other methods 
  (val_real,val_str,val_int,val_decimal):
  copy null_value from the referenced Item.

modified:
  mysql-test/r/func_time.result
  mysql-test/t/func_time.test
  sql/item.cc
2012-01-12 13:02:51 +04:00
Michael Widenius
6d4224a31c Merge with 5.2.
no_error handling for select (used by INSERT ... SELECT) still needs to be fixed, but I will do that in a separate commit
2011-12-11 11:34:44 +02:00
Sergei Golubchik
d2755a2c9c 5.3->5.5 merge 2011-11-22 18:04:38 +01:00