Commit graph

654 commits

Author SHA1 Message Date
Alexey Kopytov
66fa3c09a3 Added a missing bit from the original patch for bug #27483 which was lost when re-applying
the patch manually to another tree.
2008-12-09 13:19:46 +03:00
Sergey Glukhov
7b488c46a0 Bug#40365 Prepared statements may insert invalid dates.
set DATE|DATETIME value to 0 if ALLOW_INVALID_DATES sql_mode is not enabled.
2008-11-27 16:41:25 +04:00
Kristofer Pettersson
18b3eacbc6 Bug#38469 invalid memory read and/or crash with utf8 text field, stored procedure, uservar
A stored procedure involving substrings could crash the server on certain
platforms because of invalid memory reads.
          
During storing the new blob-field value, the cached value's address range
overlapped that of the new field value. This caused problems when the 
cached value storage was reallocated to provide access for a new 
characater set representation. The patch checks the address ranges, and if
they overlap, the new field value is copied to a new storage before it is
converted to the new character set.
2008-09-20 10:51:03 +02:00
gshchepa/uchum@host.loc
1c45081b52 Partial rollback of fix for bug #30059: End-space truncation is inconsistent
or incorrect.

For better conformance with standard, truncation procedure of CHAR columns
has been changed to ignore truncation of trailing whitespace characters
(note has been removed).

Finally, for columns with non-binary charsets:

1. CHAR(N) columns silently ignore trailing whitespace truncation;
2. VARCHAR and TEXT columns issue Note about truncation.

BLOBs and other columns with BINARY charset are unaffected.
2008-05-06 21:43:46 +05:00
cmiller@zippy.cornsilk.net
82d8a99c05 Fix mismerge. 2008-04-10 15:55:37 -04:00
cmiller@zippy.cornsilk.net
b506166a0c Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug15776/my50-bug15776
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-build
2008-04-09 12:27:51 -04:00
cmiller@zippy.cornsilk.net
3e2457b71a Follow-up to B-g#15776, test failures on 64-bit linux.
Make maximum blob size to be 2**32-1, regardless of word size.

Fix failure of timestamp with size of 2**31-1.  The method of
rounding up to the nearest even number would overflow.
2008-04-09 12:27:30 -04:00
cmiller@zippy.cornsilk.net
c83c18c058 Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug15776/my50-bug15776
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-build
2008-04-02 10:56:49 -04:00
gshchepa/uchum@host.loc
2e9f2b678c Fixed bug#15409: Columns with 64-element SET may not be updated with integers.
SET column storing procedure has been modified to be 64bit-clean.
2008-02-08 16:04:01 +04:00
gshchepa/uchum@host.loc
8715855aa0 Fixed bug#30059.
Server handles truncation for assignment of too-long values
into CHAR/VARCHAR/TEXT columns in a different ways when the
truncated characters are spaces:
1. CHAR(N) columns silently ignore end-space truncation;
2. TEXT columns post a truncation warning/error in the
   non-strict/strict mode.
3. VARCHAR columns always post a truncation note in
   any mode.

Space truncation processing has been synchronised over
CHAR/VARCHAR/TEXT columns: current behavior of VARCHAR
columns has been propagated as standard.

Binary-encoded string/BLOB columns are not affected.
2008-02-07 02:33:21 +04:00
tnurnberg@white.intern.koehntopp.de
d1637b2ec4 Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  mysql.com:/misc/mysql/31990/50-31990
2007-12-20 08:35:52 +01:00
mhansson/martin@linux-st28.site
0004b99b58 Merge mhansson@bk-internal:/home/bk/mysql-5.0-opt
into  linux-st28.site:/home/martin/mysql/src/bug32848/my50-bug32848
2007-12-19 15:59:05 +01:00
gluh@eagle.(none)
e039595029 Merge mysql.com:/home/gluh/MySQL/Merge/5.0
into  mysql.com:/home/gluh/MySQL/Merge/5.0-opt
2007-12-13 14:52:49 +04:00
sergefp@mysql.com
dd0854db54 BUG#32198: Comparison of DATE with DATETIME still not using indexes correctly
- Make conditions like "date_col $CMP$ 'datetime-const'" range-sargable
2007-12-13 13:38:22 +03:00
mhansson/martin@linux-st28.site
867a786549 Bug#32848: Data type conversion bug in union subselects in MySQL 5.0.38
There were two problems when inferring the correct field types resulting from
UNION queries.
- If the type is NULL for all corresponding fields in the UNION, the resulting 
  type would be NULL, while the type is BINARY(0) if there is just a single 
  SELECT NULL.
- If one SELECT in the UNION uses a subselect, a temporary table is created
  to represent the subselect, and the result type defaults to a STRING type,
  hiding the fact that the type was unknown(just a NULL value).
Fixed by remembering whenever a field was created from a NULL value and pass
type NULL to the type coercion if that is the case, and creating a string field
as result of UNION only if the type would otherwise be NULL.
2007-12-11 20:15:03 +01:00
tnurnberg@mysql.com/white.intern.koehntopp.de
3f0f275030 Bug#31990: MINUTE() and SECOND() return bogus results when used on a DATE
HOUR(), MINUTE(), ... returned spurious results when used on a DATE-cast.
This happened because DATE-cast object did not overload get_time() method
in superclass Item. The default method was inappropriate here and
misinterpreted the data.

Patch adds missing method; get_time() on DATE-casts now returns SQL-NULL
on NULL input, 0 otherwise. This coincides with the way DATE-columns
behave.

Also fixes similar bug in Date-Field now.
2007-12-11 10:12:05 +01:00
tsmith@ramayana.hindu.god
10cab933b2 Merge tsmith@bk-internal.mysql.com:/home/bk/mysql-5.0
into  ramayana.hindu.god:/home/tsmith/m/bk/maint/50
2007-12-04 20:58:21 -07:00
kaa@polly.(none)
d905aade4f Windows-specific fixes in floating point tests. 2007-12-02 13:49:12 +03:00
kaa@polly.(none)
55acce7504 Fixed the floating point number tests on Windows. 2007-12-01 15:25:24 +03:00
kaa@polly.(none)
33125cd40e Fixed the build failure on Windows. It does not have trunc() defined in math.h, so we should not use it code. 2007-12-01 12:46:25 +03:00
kaa@polly.(none)
7fd9135bb8 Fix for bug #26788 "mysqld (debug) aborts when inserting specific
numbers into char fields" and bug #12860 "Difference in zero padding of
exponent between Unix and Windows"

Rewrote the code that determines what 'precision' argument should be
passed to sprintf() to fit the string representation of the input number
into the field.
We get finer control over conversion by pre-calculating the exponent, so
we are able to determine which conversion format, 'e' or 'f', will be
used by sprintf().
We also remove the leading zero from the exponent on Windows to make it
compatible with the sprintf() output on other platforms.
2007-12-01 10:05:59 +03:00
gkodinov/kgeorge@magare.gmz
d066e2173c Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B30825-new-5.0-opt
2007-10-23 11:26:37 +03:00
gkodinov/kgeorge@magare.gmz
d67cd9e8af Bug #31221: Optimizer incorrectly identifies impossible WHERE clause
No warning was generated when a TIMESTAMP with a non-zero time part
 was converted to a DATE value. This caused index lookup to assume
 that this is a valid conversion and was returning rows that match 
 a comparison between a TIMESTAMP value and a DATE keypart.
 Fixed by generating a warning on such a truncation.
2007-10-18 15:19:04 +03:00
gkodinov/kgeorge@magare.gmz
e971b18f06 Bug #30825: Problems when putting a non-spatial index on a GIS column
Fixed the usage of spatial data (and Point in specific) with 
 non-spatial indexes.
 Several problems :
   - The length of the Point class was not updated to include the 
     spatial reference system identifier. Fixed by increasing with 4 
     bytes.
   - The storage length of the spatial columns was not accounting for
     the length that is prepended to it. Fixed by treating the 
     spatial data columns as blobs (and thus increasing the storage
     length)
   - When creating the key image for comparison in index read wrong
     key image was created (the one needed for and r-tree search,
     not the one for b-tree/other search). Fixed by treating the
     spatial data columns as blobs (and creating the correct kind of
     image based on the index type).
2007-10-10 16:26:02 +03:00
evgen@moonbone.local
77dabba63f Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  moonbone.local:/work/27990-bug-5.0-opt-mysql
2007-09-28 23:27:23 +00:00
evgen@moonbone.local
b9e81c2ae3 Bug#27990: Wrong info in MYSQL_FIELD struct members when a tmp table was used.
The change_to_use_tmp_fields function leaves the orig_table member of an
expression's tmp table field filled for the new Item_field being created.
Later orig_table is used by the Field::make_field function to provide some
info about original table and field name to a user. This is ok for a field
but for an expression it should be empty.

The change_to_use_tmp_fields function now resets orig_table member of
an expression's tmp table field to prevent providing a wrong info to a user.
The Field::make_field function now resets the table_name and the org_col_name
variables when the orig_table is set to 0.
2007-09-28 23:24:40 +00:00
cmiller@zippy.cornsilk.net
3185f0046d Bug#15776: 32-bit signed int used for length of blob
Based on contributed patch from Martin Friebe, CLA from 2007-02-24.

The parser lacked support for field sizes after signed long,
when it should extend to 2**32-1.

Now, we correct that limitation, and also make the error handling
consistent for casts.
2007-08-31 15:24:43 -04:00
gkodinov/kgeorge@magare.gmz
117c3ff9d7 Bug #29536: timestamp inconsistent in replication around 1970
MySQL replicates the time zone only when operations that involve
it are performed. This is controlled by a flag. But this flag
is set only on successful operation.
The flag must be set also when there is an error that involves
a timezone (so the master would replicate the error to the slaves). 

Fixed by moving the setting of the flag before the operation
(so it apples to errors as well).
2007-08-06 04:57:28 -07:00
gshchepa/uchum@gleb.loc
bb22e3667e Merge gleb.loc:/home/uchum/work/bk/5.0
into  gleb.loc:/home/uchum/work/bk/5.0-opt
2007-07-26 03:33:43 +05:00
igor@olga.mysql.com
54f3949a27 Fixed bug #29611.
If a primary key is defined over column c of enum type then 
the EXPLAIN command for a look-up query of the form
  SELECT * FROM t WHERE c=0
said that the query was with an impossible where condition though the
query correctly returned non-empty result set when the table indeed 
contained rows with error empty strings for column c. 

This kind of misbehavior was due to a bug in the function 
Field_enum::store(longlong,bool) that erroneously returned 1 if
the the value to be stored was equal to 0. 
Note that the method 
Field_enum::store(const char *from,uint length,CHARSET_INFO *cs)
correctly returned 0 if a value of the error empty string 
was stored.
2007-07-22 18:26:16 -07:00
kent@kent-amd64.(none)
9d247f296a Merge kboortz@bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/kent/bk/tmp3/mysql-5.0-build
2007-07-21 01:53:19 +02:00
joerg@trift-lap.fambruehe
f4e73e7cc7 Merge trift-lap.fambruehe:/MySQL/M50/mysql-5.0
into  trift-lap.fambruehe:/MySQL/M50/push-5.0
2007-07-16 19:06:11 +02:00
evgen@moonbone.local
e717f9d2eb Bug#29729: Wrong conversion error led to an empty result set.
The Field_newdate::store when storing a DATETIME value was returning the
'value was cut' error even if the thd->count_cuted_fields flag is set to
CHECK_FIELD_IGNORE. This made range optimizr think that there is no
appropriate data in the table and thus to return an empty set.

Now the Field_newdate::store function returns conversion error only if the
thd->count_cuted_fields flag isn't set to CHECK_FIELD_IGNORE.
2007-07-14 22:43:58 +04:00
igor@olga.mysql.com
63d538575b Fixed bug #29417.
An assertion abort could occur for some grouping queries that employed 
decimal user variables with assignments to them.

The problem appeared the constructors of the class Field_new_decimal
because the function my_decimal_length_to_precision did not guarantee
returning decimal precision not greater than DECIMAL_MAX_PRECISION.
2007-07-07 12:31:55 -07:00
df@pippilotta.erinye.com
5aa0716817 Merge dev:/data0/mysqldev/my/build-200706140748-5.0.44/mysql-5.0-release
into  pippilotta.erinye.com:/shared/home/df/mysql/build/mysql-5.0-build
2007-06-29 12:19:38 +02:00
kent/mysqldev@mysql.com/production.mysql.com
2418b85046 configure.in:
Added --with-system-type=<systype> and --with-machine-type=<machtype>
  options, to be able to override the one detected, for --version strings
field.cc, field.h, listener.cc:
  C++ compatibility change for IBM VisualAge 6 and i5/OS
2007-06-20 14:00:28 +02:00
malff/marcsql@weblab.(none)
b80692b9ff Merge weblab.(none):/home/marcsql/TREE/mysql-5.0-base
into  weblab.(none):/home/marcsql/TREE/mysql-5.0-rt-merge
2007-06-15 08:56:40 -06:00
holyfoot/hf@hfmain.(none)
8ccc50b303 Merge bk@192.168.21.1:mysql-5.0
into  mysql.com:/d2/hf/mrg/mysql-5.0-opt
2007-06-14 16:41:10 +05:00
malff/marcsql@weblab.(none)
046e489bc5 Merge weblab.(none):/home/marcsql/TREE/mysql-5.0-base
into  weblab.(none):/home/marcsql/TREE/mysql-5.0-rt-merge
2007-06-11 11:32:10 -06:00
anozdrin/alik@ibm.
bacc6ee071 Fix for BUG#27592: stack overrun when storing datetime value
using prepared statements.
2007-06-07 13:50:22 +04:00
gkodinov/kgeorge@magare.gmz
b1e936b9e5 Bug#28878: InnoDB tables with UTF8 character set and indexes cause
wrong result for DML
When making key reference buffers over CHAR fields whitespace (0x20) 
must be used to fill in the remaining space in the field's buffer.
This is what Field_string::store() does.
Fixed Field_string::get_key_image() to do the same.
2007-06-07 10:08:44 +03:00
tsmith@quadxeon.mysql.com
d2fe24d1ef Merge tsmith@bk-internal.mysql.com:/home/bk/mysql-5.0
into  quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/maint/jun05/50
2007-06-05 23:04:40 +02:00
evgen@moonbone.local
85b6e3f00d Bug#28729: Field_enum wrongly reported an error while storing an empty string.
ENUM fields internally store their values as integers and may use integer
values as indexes to their values. Invalid values are mapped to zero value.
When storing an empty string the ENUM field fails to find an appropriate value
and tries to convert the provided string to integer. The conversion also
fails and error is returned even if the thd->count_cuted_fields is set to
CHECK_FIELD_IGNORE. This makes the range optimizer wrongly decide that an
impossible range is present.

Now the Field_enum::store() returns error while storing an empty string only
if the thd->count_cuted_fields isn't set to CHECK_FIELD_IGNORE.
2007-05-30 23:28:14 +04:00
kaa@polly.local
afc59d3381 Some Windows-related fixes to make Microsoft compilers happy. This is for bug #28128. 2007-05-28 15:33:22 +04:00
kaa@polly.local
84c81bd534 Merge polly.local:/home/kaa/src/maint/bug28121/my50-bug28121
into  polly.local:/home/kaa/src/maint/mysql-5.0-maint
2007-05-28 14:34:36 +04:00
kaa@polly.local
8ac1ffdf1d Fix for bug #28121 "INSERT or UPDATE into DOUBLE(200,0) field being truncated to 31 digits"
When storing a large number to a FLOAT or DOUBLE field with fixed length, it could be incorrectly truncated if the field's length was greater than 31.

This patch also does some code cleanups to be able to reuse code which is common between Field_float::store() and Field_double::store().
2007-05-28 12:44:59 +04:00
tsmith@siva.hindu.god
30bc713c77 Merge siva.hindu.god:/home/tsmith/m/bk/50
into  siva.hindu.god:/home/tsmith/m/bk/maint/50
2007-05-17 14:17:50 -06: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
holyfoot/hf@mysql.com/hfmain.(none)
d99b4c6a1a Bug #27921 View ignores precision for CAST()
Item_decimal_typecast::print properly implemented
2007-05-10 00:17:21 +05:00
gshchepa/uchum@gshchepa.loc
85d70a9652 Merge gshchepa.loc:/home/uchum/work/bk-trees/mysql-4.1-opt
into  gshchepa.loc:/home/uchum/work/bk-trees/mysql-5.0-opt-13191
2007-04-29 08:51:51 +05:00