Commit graph

46 commits

Author SHA1 Message Date
Magne Mahre
491b8fc755 Backport to 5.6.0 2009-11-04 10:17:39 +01:00
Magne Mahre
b1006c87f7 Bug#42661: sec_to_time() and signedness
Bug#42662: maketime() and signedness
      
Item_time_typecast::val_int() dropped sign from
MYSQL_TIME gotten using from get_time().
      
Propagates sign now.


Backported to 5.5.0  (6.0-codebase revid: 1810.3897.1)
2009-11-04 09:53:38 +01:00
Gleb Shchepa
bc7c439e6b Backport of fix to bug #33629 into mysql-next-mr-bugfixing.
Bug #33629: last_day function can return null, but has 'not null' flag set for result

LAST_DAY and MAKEDATE functions are documented as
returning NULL value, but actually they was implemented
as returning NOT NULL typed values.

That caused a confusing error "ERROR 1048 (23000): Column
'...' cannot be null" on queries like: 

  SELECT 1 FROM (SELECT LAST_DAY('0')) a;
2009-10-13 21:50:08 +05:00
Tatiana A. Nurnberg
4e0e0db47e Bug#42661: sec_to_time() and signedness
Bug#42662: maketime() and signedness

Item_time_typecast::val_int() dropped sign from
MYSQL_TIME gotten using from get_time().

Propagates sign now.
2009-02-09 06:21:48 +01:00
Timothy Smith
2515ce79e8 Auto-merge up from 5.0 2009-02-07 16:50:31 +01:00
Tatiana A. Nurnberg
b16ad3bac2 Bug#42525: TIMEDIFF function
In 37553 we declared longlong results for
class Item_str_timefunc as per comments/docs,
but didn't add a method for that. And the
default just wasn't good enough for some
cases.

Changeset adds dedicated val_int() to class.
2009-02-06 18:25:08 +01:00
Tatiana A. Nurnberg
9700cd87d9 auto-merge 2008-11-27 12:33:04 +01:00
Tatiana A. Nurnberg
ae0c6a949c Bug#37553: MySql Error Compare TimeDiff & Time
We pretended that TIMEDIFF() would always return positive results;
this gave strange results in comparisons of the TIMEDIFF(low,hi)<TIME(0)
type that rendered a negative result, but still gave false in comparison.
We also inadvertantly dropped the sign when converting times to
decimal.

CAST(time AS DECIMAL) handles signs of the times correctly.
TIMEDIFF() marked up as signed. Time/date comparison code switched to
signed for clarity.
2008-11-26 09:28:17 +01:00
gluh@eagle.(none)
17acda6ca8 Merge mysql.com:/home/gluh/MySQL/Merge/5.1
into  mysql.com:/home/gluh/MySQL/Merge/5.1-opt
2007-10-23 19:08:21 +05:00
gluh@eagle.(none)
237383f0fe Merge mysql.com:/home/gluh/MySQL/Merge/5.0
into  mysql.com:/home/gluh/MySQL/Merge/5.0-opt
2007-10-23 18:51:43 +05:00
tnurnberg@sin.intern.azundris.com
0ea99b5e27 Merge sin.intern.azundris.com:/home/tnurnberg/30951/50-30951
into  sin.intern.azundris.com:/home/tnurnberg/30951/51-30951
2007-10-12 11:47:28 +02:00
tnurnberg@sin.intern.azundris.com
57dc381268 Bug#30951: makedate returns different results depending on version of mysql
makedate() will fold years below 100 into the 1970-2069 range. CS removes code
that also wrongly folded years between 100 and 200 into that range, which should
be left unchanged. Backport from 5.1.
2007-10-12 11:46:48 +02:00
mhansson/martin@linux-st28.site
6d6c475fe8 Merge linux-st28.site:/home/martin/mysql/src/bug31160/my50-bug31160
into  linux-st28.site:/home/martin/mysql/src/bug31160/my51-bug31160
2007-10-09 15:00:06 +02:00
mhansson/martin@linux-st28.site
148ce22add Bug#31160: MAKETIME() crashes server when returning NULL in ORDER BY using filesort
Even though it returns NULL, the MAKETIME function did not have this property set,
causing a failed assertion (designed to catch exactly this).
Fixed by setting the nullability property of MAKETIME().
2007-10-09 14:58:09 +02:00
msvensson@pilot.blaudden
a65d12a830 Backport of TIME->MYSQL_TIME / Y2K fixset
Made year 2000 handling more uniform
Removed year 2000 handling out from calc_days()
The above removes some bugs in date/datetimes with year between 0 and 200
Now we get a note when we insert a datetime value into a date column
For default values to CREATE, don't give errors for warning level NOTE
Fixed some compiler failures
Added library ws2_32 for windows compilation (needed if we want to compile with IOCP support)
Removed duplicate typedef TIME and replaced it with MYSQL_TIME

Better (more complete) fix for: Bug#21103 "DATE column not compared as DATE"
Fixed properly Bug#18997 "DATE_ADD and DATE_SUB perform year2K autoconversion magic on 4-digit year value"
Fixed Bug#23093 "Implicit conversion of 9912101 to date does not match cast(9912101 as date)"
2007-05-16 10:44:59 +02:00
monty@mysql.com/narttu.mysql.fi
1933603647 Removed not used define YY_MAGIC_BELOW
Made year 2000 handling more uniform
Removed year 2000 handling out from calc_days()
The above removes some bugs in date/datetimes with year between 0 and 200
Now we get a note when we insert a datetime value into a date column
For default values to CREATE, don't give errors for warning level NOTE
Fixed some compiler failures
Added library ws2_32 for windows compilation (needed if we want to compile with IOCP support)
Removed duplicate typedef TIME and replaced it with MYSQL_TIME

Better (more complete) fix for: Bug#21103 "DATE column not compared as DATE"
Fixed properly Bug#18997 "DATE_ADD and DATE_SUB perform year2K autoconversion magic on 4-digit year value"
Fixed Bug#23093 "Implicit conversion of 9912101 to date does not match cast(9912101 as date)"
2007-03-23 22:08:31 +02:00
ramil/ram@ramil.myoffice.izhnet.ru
363b0b6ff1 Merge mysql.com:/home/ram/work/b23616/b23616.5.0
into  mysql.com:/home/ram/work/b23616/b23616.5.1
2007-03-02 15:13:28 +04:00
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
4a5dd6956d Merge mysql.com:/home/ram/work/b23616/b23616.4.1
into  mysql.com:/home/ram/work/b23616/b23616.5.0
2007-03-02 15:09:20 +04:00
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
10475626c1 Fix for bug #23616: Week() changed behaviour between 5.0.22 and 5.0.24
Consider double values as legal date{time} function's arguments
(i.e. allow dates in internal format YYYYMMDDHHMMSS.XXXXXX).
2006-12-26 15:08:41 +04:00
kaa@polly.local
29b5e2955e Merge polly.local:/tmp/maint/bug11655/my50-bug11655
into  polly.local:/tmp/maint/bug11655/my51-bug11655
2006-10-11 14:22:17 +04:00
kaa@polly.local
02ac635027 Merge polly.local:/tmp/maint/bug11655/my41-bug11655
into  polly.local:/tmp/maint/bug11655/my50-bug11655
2006-10-11 14:16:30 +04:00
kaa@polly.local
609a3cd295 Fixes a number of problems with time/datetime <-> string conversion functions:
- bug #11655 "Wrong time is returning from nested selects - maximum time exists
- input and output TIME values were not validated properly in several conversion functions
- bug #20927 "sec_to_time treats big unsigned as signed"
- integer overflows were not checked in several functions. As a result, input values like 2^32 or 3600*2^32 were treated as 0
- BIGINT UNSIGNED values were treated as SIGNED in several functions
- in cases where both input string truncation and out-of-range TIME value occur, only 'truncated incorrect time value' warning was produced
2006-10-04 17:13:32 +04:00
ingo@chilla.local
db0e7774aa Merge chilla.local:/home/mydev/mysql-5.0-ateam
into  chilla.local:/home/mydev/mysql-5.1-ateam
2006-07-06 13:18:00 +02:00
ingo@mysql.com
a21071d912 Merge mysql.com:/home/mydev/mysql-4.1-bug14400
into  mysql.com:/home/mydev/mysql-5.0-ateam
2006-07-05 11:20:10 +02:00
evgen@moonbone.local
3cc6d95d18 Merge 2006-06-30 02:03:09 +04:00
kroki@mysql.com
49cc2904d2 Dec. 31st, 9999 is still a valid date, only starting with Jan 1st 10000 things become invalid (Bug #12356) 2006-06-27 19:33:59 +04:00
gluh@eagle.intranet.mysql.r18.ru
e9d70e4b97 Fix for bug#8294 Traditional: Misleading error message for invalid CAST to DATE
-issue more correct message for incorrect date|datetime|time values
  -ER_WARN_DATA_OUT_OF_RANGE message is changed
  -added new error message
2005-12-02 15:01:44 +04:00
monty@mysql.com
e5f48e13bf Reverting patch for BUG #14009 (use of abs() on null value causes problems with filesort
Fix for bug #14536: SELECT @a,@a:=... fails with prepared statements
2005-11-01 15:54:30 +02:00
monty@mysql.com
19502e8eb5 Review of new pushed code
Removed wrong fix for bug #14009 (use of abs() on null value causes problems with filesort)
Mark that add_time(), time_diff() and str_to_date() can return null values
2005-11-01 13:00:02 +02:00
dlenev@brandersnatch.localdomain
03d8c01a4c Fixed test results after merging fix for bug #8068 "TIMEDIFF with first
negative argument gives wrong result" into 5.0 tree.
2005-04-18 15:58:58 +04:00
dlenev@mysql.com
a95ede0527 Manual merge of patch for bug #8068 "TIMEDIFF with first negative
argument gives wrong result" (and similar bug in ADDTIME/SUBTIME)
into 5.0 tree.
2005-04-18 14:29:31 +04:00
dlenev@brandersnatch.localdomain
aae37f5ea5 Fix for bug #8068 "TIMEDIFF with first negative argument gives wrong
result" (and similar bug in ADDTIME/SUBTIME).

Both Item_func_add_time/Item_func_timediff::val_str() now use
calc_time_diff() function which was backported from 5.0 (and which
was was fixed to properly handle microseconds part of its second 
argument). Also now we correctly set sign of result in case when
first argument is negative and second is positive.
2005-03-28 16:20:55 +04:00
dlenev@brandersnatch.localdomain
31d3aabb49 Porting fix for bug #7586 "TIMEDIFF for sec+microsec not working properly"
to 5.0 tree (since it was lost during last merge).
2005-01-15 20:02:46 +03:00
monty@mysql.com
8d616390e9 After merge fixes
Fix for BIT(X) field as string
2005-01-15 17:38:43 +02:00
monty@mysql.com
0a1076a25f Merge with 4.1 2005-01-15 14:09:45 +02:00
dlenev@brandersnatch.localdomain
23c9e0a75a Fix for bug #7586 "TIMEDIFF for sec+microsec not working properly". 2005-01-12 12:18:36 +03:00
gluh@gluh.mysql.r18.ru
2e912bbbe8 Don't display 'usage' privilege in TABLE_PRIVILEGES if we have columns privileges
mysqldump skips information_schema db
'use' now can use information_schema db
changed value of column 'Null' to 'NO' if column is not nullable
2004-12-10 12:07:11 +03:00
monty@mishka.local
f2941380c4 Strict mode & better warnings
Under strict mode MySQL will generate an error message if there was any conversion when assigning data to a field.
Added checking of date/datetime fields.
If strict mode, give error if we have not given value to field without a default value (for INSERT)
2004-09-28 20:08:00 +03:00
monty@mysql.com
1e31199995 Merge with 4.1.3-beta 2004-07-07 11:29:39 +03:00
dlenev@brandersnatch.localdomain
09ba29e539 WL#1264 "Per-thread time zone support infrastructure".
Added basic per-thread time zone functionality (based on public
domain elsie-code). Now user can select current time zone
(from the list of time zones described in system tables).
All NOW-like functions honor this time zone, values of TIMESTAMP
type are interpreted as values in this time zone, so now
our TIMESTAMP type behaves similar to Oracle's TIMESTAMP WITH
LOCAL TIME ZONE (or proper PostgresSQL type).
  
WL#1266 "CONVERT_TZ() - basic time with time zone conversion 
function".
  
Fixed problems described in Bug #2336 (Different number of warnings 
when inserting bad datetime as string or as number). This required
reworking of datetime realted warning hadling (they now generated 
at Field object level not in conversion functions).
  
Optimization: Now Field class descendants use table->in_use member
instead of current_thd macro.
2004-06-18 10:11:31 +04:00
pem@mysql.com
dfd59e296e Merge 4.1 -> 5.0. 2004-04-07 19:07:44 +02:00
gluh@gluh.mysql.r18.ru
df0ede69fc Task #835: additional changes fot str_to_date 2004-03-15 18:28:21 +04:00
jani@ua72d24.elisa.omakaista.fi
8dcb41d8d9 Fixed Bug#3115. CAST AS DATE with malformed string returns NULL but IS NULL
is false.
2004-03-09 22:03:01 +02:00
gluh@gluh.mysql.r18.ru
ec8749249a WL#530&531: TIMESTAMPADD, TIMESTAMPDIFF functions
Syntax for TIMESTAMPADD:

TIMESTAMPADD(interval, integer_expression, datetime_expression)

interval:= FRAC_SECOND | SECOND | MINUTE | HOUR | DAY | WEEK | MONTH | 
QUARTER | YEAR

Supported SQL_TSI_  prefix  (like SQL_TSI_SECOND)

Syntax for TIMESTAMPDIFF:

TIMESTAMPDIFF(interval, datetime_expression1, datetime_expression2)

interval:= FRAC_SECOND | SECOND | MINUTE | HOUR | DAY | WEEK | MONTH | 
QUARTER | YEAR

Supported SQL_TSI_  prefix  (like SQL_TSI_SECOND)
2003-12-08 14:41:41 +04:00
gluh@gluh.mysql.r18.ru
5709ed20ab SAPDB date/time finctions 2003-07-08 15:06:05 +05:00
gluh@gluh.mysql.r18.ru
66af4b5c9a Internal commit 2003-06-23 12:56:44 +05:00