Commit graph

496 commits

Author SHA1 Message Date
Georgi Kodinov
8c25823f94 merged 5.1-main -> 5.1-bugteam 2009-01-05 18:10:20 +02:00
Davi Arnaut
4bdb3d87fa Fix warnings and bug spotted by gcc-4.3.
Related to operator precedence and associativity.
Make the expressions as explicit as possible.
2008-12-16 10:12:22 -02:00
Build Team
366adeab08 Added "Sun Microsystems, Inc." to copyright headers on files modified
since Oct 1st
2008-11-10 21:21:49 +01:00
Ramil Kalimullin
adf630dcee Fix for bug#23113: Different behavior on altering ENUM fields between 5.0 and 5.1
Problem: mysqld doesn't detect that enum data must be reinserted performing
'ALTER TABLE' in some cases.

Fix: reinsert data altering an enum field if enum values are changed.
2008-10-24 13:00:03 +05:00
Kristofer Pettersson
53cf8914e4 Merge 5.0-bugteam -> 5.1-bugteam 2008-09-20 16:52:34 +02: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
Georgi Kodinov
4c318bf6e8 merge 5.0-bugteam -> 5.1-bugteam 2008-08-28 12:54:50 +03:00
Gleb Shchepa
2c53f10969 Bug #37799: SELECT with a BIT column in WHERE clause
returns unexpected result

If:
  1. a table has a not nullable BIT column c1 with a length
     shorter than 8 bits and some additional not nullable
     columns c2 etc, and
  2. the WHERE clause is like: (c1 = constant) AND c2 ...,
the SELECT query returns unexpected result set.


The server stores BIT columns in a tricky way to save disk
space: if column's bit length is not divisible by 8, the
server places reminder bits among the null bits at the start
of a record. The rest bytes are stored in the record itself,
and Field::ptr points to these rest bytes.

However if a bit length of the whole column is less than 8,
there are no remaining bytes, and there is nothing to store in
the record at its regular place. In this case Field::ptr points
to bytes actually occupied by the next column in a record.
If both columns (BIT and the next column) are NOT NULL,
the Field::eq function incorrectly deduces that this is the
same column, so query transformation/equal item elimination
code (see build_equal_items_for_cond) may mix these columns
and damage conditions containing references to them.
2008-08-28 02:10:37 +05:00
Marc Alff
385b4bf7ff Manual merge of mysql-5.0-bugteam -> mysql-5.1-bugteam
Note: NULL merge of sql/sql_yacc.yy, the fix for bug#38296 will be provided separately for 5.1
2008-08-11 16:44:13 -06:00
Marc Alff
394691cd90 Bug#38296 (low memory crash with many conditions in a query)
This fix is for 5.0 only : back porting the 6.0 patch manually

The parser code in sql/sql_yacc.yy needs to be more robust to out of
memory conditions, so that when parsing a query fails due to OOM,
the thread gracefully returns an error.

Before this fix, a new/alloc returning NULL could:
- cause a crash, if dereferencing the NULL pointer,
- produce a corrupted parsed tree, containing NULL nodes,
- alter the semantic of a query, by silently dropping token values or nodes

With this fix:
- C++ constructors are *not* executed with a NULL "this" pointer
when operator new fails.
This is achieved by declaring "operator new" with a "throw ()" clause,
so that a failed new gracefully returns NULL on OOM conditions.

- calls to new/alloc are tested for a NULL result,

- The thread diagnostic area is set to an error status when OOM occurs.
This ensures that a request failing in the server properly returns an
ER_OUT_OF_RESOURCES error to the client.

- OOM conditions cause the parser to stop immediately (MYSQL_YYABORT).
This prevents causing further crashes when using a partially built parsed
tree in further rules in the parser.

No test scripts are provided, since automating OOM failures is not
instrumented in the server.
Tested under the debugger, to verify that an error in alloc_root cause the
thread to returns gracefully all the way to the client application, with
an ER_OUT_OF_RESOURCES error.
2008-08-11 10:10:00 -06:00
Kristofer Pettersson
5c1f8d1836 Bug#38002 table_cache consumes too much memory with blobs
Tables in the table definition cache are keeping a cache buffer for blob
fields which can consume a lot of memory.
    
This patch introduces a maximum size threshold for these buffers.
2008-07-24 22:38:44 +02:00
Joerg Bruehe
241581fb8d Merge 5.1.26-rc to 5.1-build for further pushing it to the main tree. 2008-07-11 20:51:10 +02:00
Mats Kindahl
2a089557a6 BUG#37426: RBR breaks for CHAR() UTF-8 fields > 85 chars
In order to handle CHAR() fields, 8 bits were reserved for
the size of the CHAR field. However, instead of denoting the
number of characters in the field, field_length was used which
denotes the number of bytes in the field.

Since UTF-8 fields can have three bytes per character (and
has been extended to have four bytes per character in 6.0),
an extra two bits have been encoded in the field metadata
work for fields of type Field_string (i.e., CHAR fields).

Since the metadata word is filled, the extra bits have been
encoded in the upper 4 bits of the real type (the most 
significant byte of the metadata word) by computing the
bitwise xor of the extra two bits. Since the upper 4 bits
of the real type always is 1111 for Field_string, this 
means that for fields of length <256, the encoding is
identical to the encoding used in pre-5.1.26 servers, but
for lengths of 256 or more, an unrecognized type is formed,
causing an old slave (that does not handle lengths of 256
or more) to stop.
2008-06-30 22:11:18 +02:00
Gleb Shchepa
954fba4739 Fixed bug #37076: TIMESTAMP/DATETIME/DATE values are not
replicated correctly between machines with
                  mixed endiannes
2008-06-19 18:02:04 +05:00
gshchepa/uchum@host.loc
ebc6e02dee Merge host.loc:/work/bugs/5.0-bugteam-30059
into  host.loc:/work/bk/5.1-bugteam
2008-05-13 17:01:02 +05: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
istruewing@stella.local
eabe082d6f Manual merge 2008-03-14 12:02:11 +01:00
bar@mysql.com/bar.myoffice.izhnet.ru
f83cc8e6db Bug#23924 general_log truncates queries with character set introducers.
Problem: logging of utf8-incompatible binary strings didn't work
Fix: hex-encoding of incompatible sequences.
2008-02-29 17:56:50 +04:00
kaa@kaamos.(none)
9f194149b8 Merge kaamos.(none):/data/src/opt/mysql-5.0-opt
into  kaamos.(none):/data/src/opt/mysql-5.1-opt
2008-02-13 12:12:00 +03:00
mattiasj@witty.local
5d4e9d040e Bug#33379: valgrind error in parts/partition_bit_myisam
Problem was that Field_bit used Field::hash() function that did not
know about using null-byte for storing bits.
Resulting in wrong length, which was caught by valgrind.

Solution: created a Field_bit::hash() that uses Field_bit::val_int()
and my_charset_bin-collation function hash_sort.
Also use the store function for platform independs
2008-02-07 12:28:38 +01: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
gkodinov/kgeorge@macbook.gmz
5b9e61b282 merge of bug 33256 5.0-opt -> 5.1-opt 2008-01-08 12:27:15 +02:00
gkodinov/kgeorge@macbook.gmz
2710053416 Merge macbook.gmz:/Users/kgeorge/mysql/work/B33256-5.0-opt
into  macbook.gmz:/Users/kgeorge/mysql/work/B33256-5.1-opt
2008-01-08 11:49:40 +02:00
gkodinov/kgeorge@magare.gmz
7fe932ed82 Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B33256-5.0-opt
2008-01-07 18:55:05 +02:00
mhansson/martin@linux-st28.site
8b65423d9d Merge mhansson@bk-internal:/home/bk/mysql-5.1-opt
into  linux-st28.site:/home/martin/mysql/src/bug32848/my51-bug32848
2007-12-21 14:52:39 +01:00
gkodinov/kgeorge@macbook.gmz
e4efb4a521 Bug #33256: CREATE ... SELECT creates obsolete table
w/ Field_date instead of Field_newdate
  
Field_date was still used in temp table creation.
Fixed by using Field_newdate consistently throughout the server
except when reading tables defined with older MySQL version.
No test suite is possible because both Field_date and Field_newdate
return the same values in all the metadata calls.
2007-12-21 12:44:24 +02:00
mhansson/martin@linux-st28.site
fe93176c30 Merge linux-st28.site:/home/martin/mysql/src/bug32848/my50-bug32848-gca
into  linux-st28.site:/home/martin/mysql/src/bug32848/my51-bug32848-gca
2007-12-20 14:19:52 +01: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
tnurnberg@white.intern.koehntopp.de
1f5b0b3954 Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-5.1-opt
into  mysql.com:/misc/mysql/31990/51-31990
2007-12-20 08:32:51 +01:00
tnurnberg@white.intern.koehntopp.de
38b888dd65 Merge mysql.com:/misc/mysql/31990/50-31990
into  mysql.com:/misc/mysql/31990/51-31990
2007-12-20 07:45:16 +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)
4f5868114a Merge mysql.com:/home/gluh/MySQL/Merge/5.1
into  mysql.com:/home/gluh/MySQL/Merge/5.1-opt
2007-12-13 15:56:04 +04: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
holyfoot/hf@hfmain.(none)
e400b54447 Merge mysql.com:/home/hf/work/31158/my50-31158
into  mysql.com:/home/hf/work/31158/my51-31158
2007-11-17 17:12:18 +04:00
holyfoot/hf@hfmain.(none)
7588fa52b6 Merge mysql.com:/home/hf/work/31158/my41-31158
into  mysql.com:/home/hf/work/31158/my50-31158
2007-11-17 16:48:57 +04:00
holyfoot/hf@mysql.com/hfmain.(none)
7d111abf0e Bug #31158 Spatial, Union, LONGBLOB vs BLOB bug (crops data)
max_length parameter for BLOB-returning functions must be big enough
for any possible content. Otherwise the field created for a table
will be too small.
2007-11-13 10:51:47 +04:00
bar@bar.myoffice.izhnet.ru
70488d7dfe Merge abarkov@bk-internal.mysql.com:/home/bk/mysql-5.1
into  mysql.com:/home/bar/mysql-work/mysql-5.1-new-rpl-merge
2007-10-30 12:03:34 +04:00
gkodinov/kgeorge@magare.gmz
3553f6eac2 Merge magare.gmz:/home/kgeorge/mysql/autopush/B30825-new-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/work/B30825-5.1-opt
2007-10-23 11:44:14 +03:00
mats@kindahl-laptop.dnsalias.net
d8adc641a0 Merge kindahl-laptop.dnsalias.net:/home/bkroot/mysql-5.1-rpl
into  kindahl-laptop.dnsalias.net:/home/bk/b29549-mysql-5.1-target-5.1.22
2007-10-12 09:40:24 +02:00
mats@kindahl-laptop.dnsalias.net
c4298a3fb9 BUG#29549 (Endians: test failures on Solaris):
Refactoring code to add parameter to pack() and unpack() functions with
purpose of indicating if data should be packed in little-endian or
native order. Using new functions to always pack data for binary log
in little-endian order. The purpose of this refactoring is to allow
proper implementation of endian-agnostic pack() and unpack() functions.

Eliminating several versions of virtual pack() and unpack() functions
in favor for one single virtual function which is overridden in
subclasses.

Implementing pack() and unpack() functions for some field types that
packed data in native format regardless of the value of the
st_table_share::db_low_byte_first flag.

The field types that were packed in native format regardless are:
Field_real, Field_decimal, Field_tiny, Field_short, Field_medium,
Field_long, Field_longlong, and Field_blob.

Before the patch, row-based logging wrote the rows incorrectly on
big-endian machines where the storage engine defined its own
low_byte_first() to be FALSE on big-endian machines (the default
is TRUE), while little-endian machines wrote the fields in correct
order. The only known storage engine that does this is NDB. In effect,
this means that row-based replication from or to a big-endian
machine where the table was using NDB as storage engine failed if the
other engine was either non-NDB or on a little-endian machine.

With this patch, row-based logging is now always done in little-endian
order, while ORDER BY uses the native order if the storage engine
defines low_byte_first() to return FALSE for big-endian machines.

In addition, the max_data_length() function available in Field_blob
was generalized to the entire Field hierarchy to give the maximum
number of bytes that Field::pack() will write.
2007-10-11 18:18:05 +02: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
malff/marcsql@weblab.(none)
1c27dd1d67 Merge weblab.(none):/home/marcsql/TREE/mysql-5.1-base
into  weblab.(none):/home/marcsql/TREE/mysql-5.1-rt-merge
2007-08-20 11:13:31 -06:00
kostja@bodhi.(none)
beb61609a1 Fix doxygen warnings. 2007-08-16 21:14:47 +04:00
lars/lthalmann@dl145k.mysql.com
2c893c14da Merge mysql.com:/nfsdisk1/lars/bkroot/mysql-5.1-new-rpl
into  mysql.com:/nfsdisk1/lars/MERGE/mysql-5.1-merge
2007-08-15 21:30:45 +02:00
gshchepa/uchum@gleb.loc
db6ec3f71f Merge gleb.loc:/home/uchum/work/bk/5.1
into  gleb.loc:/home/uchum/work/bk/5.1-opt
2007-08-11 02:00:51 +05:00
cbell/Chuck@mysql_cab_desk.
08282643ab Merge mysql_cab_desk.:C:/source/c++/mysql-5.1-new-rpl
into  mysql_cab_desk.:C:/source/c++/mysql-5.1_BUG_22086
2007-08-10 14:58:46 -04:00
cbell/Chuck@mysql_cab_desk.
e8ea4b84c0 BUG#22086 : Extra Slave Col: Char(5) on slave and Char(10) on master cause mysqld crash
This patch adds functionality to row-based replication to ensure the
slave's column sizes are >= to that of the master.

It also includes some refactoring for the code from WL#3228.
2007-08-10 12:48:01 -04:00
igor@olga.mysql.com
9037f6d9b5 Post-merge fixes. 2007-08-06 00:53:32 -07:00
igor@olga.mysql.com
676c5ef471 Merge olga.mysql.com:/home/igor/mysql-5.0-opt
into  olga.mysql.com:/home/igor/dev-opt/mysql-5.1-opt-bug30219
2007-08-05 18:39:12 -07:00