Commit graph

527 commits

Author SHA1 Message Date
evgen@moonbone.local
8c0aa3560c field.cc, field.h:
Additional fix for #16377 for bigendian platforms
sql_select.cc, select.result, select.test:
  After merge fix
2006-06-21 01:14:53 +04:00
igor@rurik.mysql.com
9b7ecb5553 Merge ibabaev@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  rurik.mysql.com:/home/igor/mysql-5.0-opt
2006-06-15 18:36:46 -07:00
evgen@moonbone.local
a2261d57be Many files:
After merge fix
2006-06-15 01:48:41 +04:00
evgen@moonbone.local
e35a0ca4b7 Manually merged 2006-06-14 23:54:08 +04:00
igor@rurik.mysql.com
3f5f33d8f8 Merge rurik.mysql.com:/home/igor/mysql-4.1-opt
into  rurik.mysql.com:/home/igor/mysql-5.0-opt
2006-06-13 20:04:48 -07:00
igor@rurik.mysql.com
355753baa4 Fixed bug #14896.
This bug in Field_string::cmp resulted in a wrong comparison 
with keys in partial indexes over multi-byte character fields.
Given field a is declared as 
  a varchar(16) collate utf8_unicode_ci
INDEX(a(4)) gives us an example of such an index.

Wrong key comparisons could lead to wrong result sets if 
the selected query execution plan used a range scan by 
a partial index over a utf8 character field.
This also caused wrong results in many other cases.
2006-06-13 19:57:50 -07:00
evgen@moonbone.local
67de8c46a5 Fixed bug#16377: result of DATE/TIME functions were compared as strings which
can lead to a wrong result.

All date/time functions has the STRING result type thus their results are
compared as strings. The string date representation allows a user to skip 
some of leading zeros. This can lead to wrong comparison result if a date/time 
function result is compared to such a string constant.

The idea behind this bug fix is to compare results of date/time functions
and data/time constants as ints, because that date/time representation is 
more exact. To achieve this the agg_cmp_type() is changed to take in the
account that a date/time field or an date/time item should be compared 
as ints.

This bug fix is partially back ported from 5.0.

The agg_cmp_type() function now accepts THD as one of parameters. 
In addition, it now checks if a date/time field/function is present in the
list. If so, it tries to coerce all constants to INT to make date/time
comparison return correct result. The field for the constant coercion is
taken from the Item_field or constructed from the Item_func. In latter case
the constructed field will be freed after conversion of all constant items.
Otherwise the result is same as before - aggregated with help of the
item_cmp_type() function.

From the Item_func_between::fix_length_and_dec() function removed the part
which was converting date/time constants to int if possible. Now this is 
done by the agg_cmp_type() function.

The new function result_as_longlong() is added to the Item class. 
It indicates that the item is a date/time item and result of it can be
compared as int. Such items are date/time fields/functions.

Correct val_int() methods are implemented for classes Item_date_typecast, 
Item_func_makedate, Item_time_typecast, Item_datetime_typecast. All these
classes are derived from Item_str_func and Item_str_func::val_int() converts
its string value to int without regard to the date/time type of these items.

Arg_comparator::set_compare_func() and Arg_comparator::set_cmp_func()
functions are changed to substitute result type of an item with the INT_RESULT
if the item is a date/time item and another item is a constant. This is done
to get a correct result of comparisons like date_time_function() = string_constant.
2006-06-13 19:09:24 +04:00
monty@mysql.com
97b941d924 Remove dflt_field from field structure as this was only needed when createing temporary table and I found another soultion that doesn't increase the size of the field structure for all table instances. (Better fix for bug #19089)
Fixed compiler warnings
Fixed valgrind warning in Item_date_add_intervall::eq. (Recoding of bugfix #19490)
2006-05-24 11:56:59 +03:00
igor@rurik.mysql.com
a6aaca7d6a Post-review fixes for bug #19089 2006-05-22 07:57:46 -07:00
igor@rurik.mysql.com
12e53358f0 Fixed bug #19089.
When a CREATE TABLE command created a table from a materialized
view id does not inherit default values from the underlying table.
Moreover the temporary table used for the view materialization
does not inherit those default values.
In the case when the underlying table contained ENUM fields it caused
misleading error messages. In other cases the created table contained
wrong default values.
The code was modified to ensure inheritance of default values for
materialized views.
2006-05-20 18:54:43 -07:00
jimw@mysql.com
a159a55c2c Merge bk-internal:/home/bk/mysql-5.0
into  mysql.com:/home/jimw/my/mysql-5.0-clean
2006-04-10 14:30:00 -07:00
jimw@mysql.com
1a59580dcd Bug #13601: Wrong int type for bit
The wrong value was being reported as the field_length for BIT
  fields, resulting in confusion for at least Connector/J. The
  field_length is now always the number of bits in the field, as
  it should be.
2006-04-04 17:54:58 -07:00
bar@mysql.com
07e21be0fe Additional 5.0 fix for
Bug#15098: CAST(column double TO signed int), wrong result
which was fixed originally in 4.1.
2006-03-29 19:31:16 +05:00
bar@mysql.com
4886c53fbb Merge abarkov@bk-internal.mysql.com:/home/bk/mysql-4.1
into  mysql.com:/usr/home/bar/mysql-4.1.b15098
2006-03-28 18:32:58 +05:00
bar@mysql.com
29b8e09732 Merge mysql.com:/usr/home/bar/mysql-4.1.b15098
into  mysql.com:/usr/home/bar/mysql-5.0
Bug#15098
2006-03-28 17:07:26 +05:00
dlenev@mysql.com
6cb5c38c14 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/dlenev/src/mysql-5.0-bg13525
2006-02-27 20:00:03 +03:00
monty@mysql.com
54274976e7 Fixed compiler warnings from gcc 4.0.2:
- Added empty constructors and virtual destructors to many classes and structs
- Removed some usage of the offsetof() macro to instead use C++ class pointers
2006-02-25 17:46:30 +02:00
konstantin@mysql.com
49ad134e9f After-merge fixes (Bug#13134) 2006-02-24 00:12:04 +03:00
konstantin@mysql.com
af62c4a959 Merge mysql.com:/opt/local/work/mysql-4.1-13134
into  mysql.com:/opt/local/work/mysql-5.0-runtime
2006-02-24 00:00:15 +03:00
konstantin@mysql.com
442c2ba8af A fix and a test case for Bug#13134 "Length of VARCHAR() utf8
column is increasing when table is recreated with PS/SP":
make use of create_field::char_length more consistent in the code.
Reinit create_field::length from create_field::char_length
for every execution of a prepared statement (actually fixes the 
bug).
2006-02-21 19:52:20 +03:00
SergeyV@selena.
624eec4f58 Merge svlasenko@bk-internal.mysql.com:/home/bk/mysql-5.0
into  selena.:H:/MYSQL/src/#15634-mysql-5.0
2006-01-30 17:03:09 +03:00
anozdrin@mysql.com
145fd62bc1 Fix for BUG#15588: String overrun during sp-vars.test
The bug appears after implementation of WL#2984
(Make stored routine variables work according to the standard).
2006-01-20 15:59:22 +03:00
serg@serg.mylan
ae3d815b41 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into serg.mylan:/usr/home/serg/Abk/mysql-5.0
2006-01-16 18:09:04 +01:00
bar@mysql.com
0e9c8395c7 Merge mysql.com:/usr/home/bar/mysql-4.1.b15581
into  mysql.com:/usr/home/bar/mysql-5.0
2006-01-12 11:38:09 +04:00
serg@serg.mylan
8dc77f267b merged 2006-01-06 18:26:59 +01:00
monty@mysql.com
b0a5ea01ef Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/my/mysql-5.0
2006-01-06 01:08:48 +02:00
monty@mysql.com
6e22e29de6 Review fixes of new pushed code
- Fixed tests
- Optimized new code
- Fixed some unlikely core dumps
- Better bug fixes for:
  - #14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
  - #14850 (ERROR 1062 when a quering a view using a Group By on a column that can be null
2006-01-06 00:47:49 +02:00
serg@serg.mylan
30c09d6dc0 merged 2006-01-03 18:12:03 +01:00
serg@serg.mylan
14f94dc0ca many warnings (practically safe but annoying) corrected 2006-01-03 17:54:54 +01:00
SergeyV@selena.
6d55b423d8 Fixes bug #15634. Eliminates compiler warning 'all return paths are recursive in
Field_date::store function'. Though the Field_date::store function almost unused
when protocol_version=10 additional check was added into it to store 4byte dates 
properly. Effective test routine is not available so far due to protocol_version
is not a dynamic property and can not be modified with mysql-test script.
2005-12-28 19:40:37 +03:00
bar@mysql.com
f206a123a1 Bug#15581: COALESCE function truncates mutli-byte TINYTEXT values
field.cc:
  BLOB variations have number-in-bytes limit,
  unlike CHAR/VARCHAR which have number-of-characters limits.
  A tinyblob column can store up to 255 bytes.
  In the case of basic Latin letters (which use 1 byte per character)
  we can store up to 255 characters in a tinyblob column.
  When passing an utf8 tinyblob column as an argument into
  a function (e.g. COALESCE) we need to reserve 3*255 bytes.
  I.e. multiply length in bytes to mbcharlen for the character set.
  Although in reality a tinyblob column can never be 3*255 bytes long,
  we need to set max_length to multiply to make fix_length_and_dec()
  of the function-caller (e.g. COALESCE) calculate the correct max_length
  for the column being created.

ctype_utf8.result, ctype_utf8.test:
  Adding test case.
2005-12-19 15:52:10 +04:00
anozdrin@mysql.com
5b981a4844 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/alik/Documents/AllProgs/MySQL/devel/5.0-sp-vars-merge-2
2005-12-07 17:17:42 +03:00
anozdrin@mysql.com
0ff8f60b45 Patch for WL#2894: Make stored routine variables work
according to the standard.

The idea is to use Field-classes to implement stored routines
variables. Also, we should provide facade to Item-hierarchy
by Item_field class (it is necessary, since SRVs take part
in expressions).

The patch fixes the following bugs:
  - BUG#8702: Stored Procedures: No Error/Warning shown for inappropriate data 
    type matching; 
 
  - BUG#8768: Functions: For any unsigned data type, -ve values can be passed 
    and returned; 
 
  - BUG#8769: Functions: For Int datatypes, out of range values can be passed 
    and returned; 
 
  - BUG#9078: STORED PROCDURE: Decimal digits are not displayed when we use 
    DECIMAL datatype; 
 
  - BUG#9572: Stored procedures: variable type declarations ignored; 
 
  - BUG#12903: upper function does not work inside a function; 
 
  - BUG#13705: parameters to stored procedures are not verified; 
 
  - BUG#13808: ENUM type stored procedure parameter accepts non-enumerated
    data; 
 
  - BUG#13909: Varchar Stored Procedure Parameter always BINARY string (ignores 
    CHARACTER SET); 
 
  - BUG#14161: Stored procedure cannot retrieve bigint unsigned;

  - BUG#14188: BINARY variables have no 0x00 padding;

  - BUG#15148: Stored procedure variables accept non-scalar values;
2005-12-07 17:01:17 +03:00
jimw@mysql.com
68bc3dd1fd Merge mysql.com:/home/jimw/my/mysql-5.0-14299
into  mysql.com:/home/jimw/my/mysql-5.0-clean
2005-12-06 14:16:34 -08:00
bar@mysql.com
3e284e22a1 Bug#15098 CAST(column double TO signed int), wrong result
field.cc:
  Adding longlong range checking to return
  LONGLONG_MIN or LONGLONG_MAX when out of range. 
  Using (longlong) cast only when range is ok.
cast.test:
  Adding test case.
cast.result:
  Fixing results accordingly.
2005-12-06 16:54:13 +04:00
ramil@mysql.com
b46c240b96 Addition to fix for bug #12956: cast make differ rounding.
- use rint() in some other val_int() methods as well.
2005-11-29 18:06:58 +04:00
ingo@production.mysql.com
49ed3c589d Merge istruewing@bk-internal.mysql.com:/home/bk/mysql-5.0
into production.mysql.com:/usersnfs/istruewing/autopush/mysql-5.0
2005-11-21 23:30:14 +01:00
bell@sanja.is.com.ua
806f9e24ff Inefficient usage of String::append() fixed.
Bad examples of usage of a string with its length fixed.
The incorrect length in the trigger file configuration descriptor
  fixed (BUG#14090).
A hook for unknown keys added to the parser to support old .TRG files.
2005-11-20 20:47:07 +02:00
jimw@mysql.com
8ecedd193b Report truncation of spaces when inserting into a BINARY or VARBINARY
field. (Bug #14299)
2005-11-15 19:21:05 -08:00
ingo@mysql.com
88b6d28aba Bug#13707 - Server crash with INSERT DELAYED on MyISAM table
After push fix. Must not access new_field if it is NULL.
2005-11-14 19:53:41 +01:00
ingo@production.mysql.com
cae673d0a9 Merge istruewing@bk-internal.mysql.com:/home/bk/mysql-5.0
into production.mysql.com:/usersnfs/istruewing/autopush/mysql-5.0
2005-11-08 20:18:08 +01:00
ingo@mysql.com
7533d92b23 Bug#13707 - Server crash with INSERT DELAYED on MyISAM table
Initialized 'ptr' for a newly instantiated varstring field.
This is required by INSERT DELAYED.

No test case. This is a migration issue. There are two shell
scripts attached to the bug report. They can be used for testing.
2005-11-07 18:31:48 +01:00
guilhem@mysql.com
ef415ceb14 Fix for BUG#14703 "Valgrind error when inserting 0 into a BIT column (like in type_bit.test)":
test "length" first (otherwise when "length" is 0, the *from invalid access still triggers a Valgrind warning).
I wrote to the Valgrind authors in case this is something fixable in Valgrind (normally the
decision to issue a warning is based on the simulated CPU condition code, which should not be undefined here).
2005-11-07 16:18:46 +01:00
patg@krsna.patg.net
7b611b33f2 BUG #14532
Added FIELD_TYPE_BIT to field method 'needs_quotes' to make BIT columns
work.
2005-10-31 17:17:16 -08:00
jani@ua141d10.elisa.omakaista.fi
44aea416f9 Merge ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-4.1
into  ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.0-tmp
2005-10-31 11:54:36 +02:00
hf@deer.(none)
5150bd8f9f Merge bk@192.168.21.1:/usr/home/bk/mysql-4.1
into deer.(none):/home/hf/work/mysql-4.1.12839
2005-10-31 12:24:43 +04:00
hf@deer.(none)
16c66d49ca Additional fix for #12839 2005-10-31 12:05:27 +04:00
sergefp@mysql.com
09a4d0c7a7 4.1->5.0 merge 2005-10-29 02:36:57 +04:00
sergefp@mysql.com
2219ada7f6 BUG#14139: When handling "CREATE TABLE(field_X type_spec,...) SELECT smth AS field_X, ...."
avoid multiplying length of field_X by charset->mbmaxlen twice when calculating space 
required for field_X in the new table.
2005-10-26 00:56:17 +04:00
monty@mysql.com
3da5f1c223 Move handling of suffix_length from strnxfrm_bin() to filesort to ensure proper sorting of all kind of binary objects
field::sort_key() now adds length last for varbinary/blob
VARBINARY/BLOB is now sorted by filesort so that shorter strings comes before longer ones
Fixed issues in test cases from last merge
2005-10-14 00:04:52 +03:00