Commit graph

110 commits

Author SHA1 Message Date
Martin Hansson
e33e01e516 Bug#44684: valgrind reports invalid reads in
Item_func_spatial_collection::val_str
        
When the concatenation function for geometry data collections
reads the binary data it was not rigorous in checking that there
is data available, leading to invalid reads and crashes.
Fixed by making checking stricter.
2009-06-17 16:58:33 +02:00
Alexey Botchkov
08690ef254 merging 2009-04-29 07:59:10 +05:00
Alexey Botchkov
d1968ad43f Bug#38990 Arbitrary data input plus GIS functions causes mysql server crash
the Point() and Linestring() functions create WKB representation of an
   object instead of an real geometry object.
   That produced bugs when these were inserted into tables.

   GIS tests fixed accordingly.
            
per-file messages:
  mysql-test/r/gis-rtree.result
Bug#38990 Arbitrary data input plus GIS functions causes mysql server crash 
    test result
  mysql-test/r/gis.result
Bug#38990 Arbitrary data input plus GIS functions causes mysql server crash 
    test result
  mysql-test/t/gis-rtree.test
Bug#38990 Arbitrary data input plus GIS functions causes mysql server crash 
    test fixed - GeomFromWKB invocations removed
  mysql-test/t/gis.test
Bug#38990 Arbitrary data input plus GIS functions causes mysql server crash 
    test fixed - AsWKB invocations added
  sql/item_geofunc.cc
Bug#38990 Arbitrary data input plus GIS functions causes mysql server crash 
     Point() and similar functions to create a proper object
2009-04-28 14:47:26 +05:00
Alexey Kopytov
0614aec4c0 Merge from dev tree. 2009-02-14 12:11:32 +03:00
Alexey Kopytov
bc790c9ff6 Merge into dev tree. 2009-02-10 16:27:35 +03:00
Alexey Kopytov
30ac49019d Fix for bug #21205: Different number of digits for float/double/real in --ps-protocol
Various parts of code used different 'precision' arguments for sprintf("%g") when converting
floating point numbers to a string. This led to differences in results in some cases 
depending on whether the text-based or prepared statements protocol is used for a query.

Fixed by changing arguments to sprintf("%g") to always be 15 (DBL_DIG) so that results are
consistent regardless of the protocol.

This patch will be null-merged to 6.0 as the problem does not exists there (fixed by the
patch for WL#2934).
2009-01-28 20:59:08 +03:00
msvensson@pilot.mysql.com
bc4874b79c Merge pilot.mysql.com:/data/msvensson/mysql/mysql-5.1-rpl
into  pilot.mysql.com:/data/msvensson/mysql/mysql-5.1-mtr
2008-03-25 18:40:49 +01:00
msvensson@pilot.mysql.com
56a354794c Merge pilot.mysql.com:/data/msvensson/mysql/mysql-5.1-rpl
into  pilot.mysql.com:/data/msvensson/mysql/mysql-5.1-mtr
2008-02-28 12:21:44 +01:00
anozdrin/alik@quad.
d36d243d3d Fix for Bug#32538: View definition picks up character set,
but not collation.

The problem here was that text literals in a view were always
dumped with character set introducer. That lead to loosing
collation information.

The fix is to dump character set introducer only if it was
in the original query. That is now possible because there 
is no problem any more of loss of character set of string
literals in views -- after WL#4052 the view is dumped 
in the original character set.
2008-02-12 22:09:16 +03:00
msvensson@pilot.mysql.com
d918988baa WL#4189
- dynamic configuration support
 - safe process
 - cleanups
 - create new suite for fedarated
2007-12-12 18:19:24 +01:00
holyfoot/hf@hfmain.(none)
ced15fccec Merge bk@192.168.21.1:mysql-5.0-opt
into  mysql.com:/home/hf/work/30284/my50-30284
2007-11-24 15:02:29 +04:00
holyfoot/hf@hfmain.(none)
4916196ed0 Merge bk@192.168.21.1:mysql-5.1-opt
into  mysql.com:/home/hf/work/30284/my51-30284
2007-11-24 15:02:23 +04:00
holyfoot/hf@hfmain.(none)
19d11753a8 Merge mysql.com:/home/hf/work/30284/my50-30284
into  mysql.com:/home/hf/work/30284/my51-30284
2007-11-24 14:57:51 +04:00
holyfoot/hf@mysql.com/hfmain.(none)
7094295d99 merging fix 2007-11-24 14:57:09 +04:00
holyfoot/hf@hfmain.(none)
d6e94bc994 Merge mysql.com:/home/hf/work/30284/my41-30284
into  mysql.com:/home/hf/work/30284/my50-30284
2007-11-24 14:47:32 +04:00
gkodinov/kgeorge@magare.gmz
784b5d7b72 Merge magare.gmz:/home/kgeorge/mysql/work/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/work/merge-5.1-opt
2007-11-23 12:26:19 +02:00
holyfoot/hf@mysql.com/hfmain.(none)
f434cb6066 test case added for the bug #31155 2007-11-20 17:04:24 +04:00
holyfoot/hf@mysql.com/hfmain.(none)
140dd4f322 Bug #30284 spatial key corruption.
SPATIAL key is fine actually, but the chk_key() function
mistakenly returns error. It tries to compare checksums
of btree and SPATIAL keys while the checksum for the SPATIAL isn't
calculated (always 0). Same thing with FULLTEXT keys is handled
using full_text_keys counter, so fixed by counting both
SPATIAL and FULLTEXT keys in that counter.
2007-11-19 11:03:03 +04: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@mysql.com/hfmain.(none)
67ce52fd66 merging 2007-11-17 17:11:05 +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
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
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
holyfoot/hf@hfmain.(none)
9f8842c265 Merge mysql.com:/home/hf/work/30286/my50-30286
into  mysql.com:/home/hf/work/30286/my51-30286
2007-10-05 16:33:37 +05:00
holyfoot/hf@hfmain.(none)
1ab2fd9bb8 Merge mysql.com:/home/hf/work/30286/my41-30286
into  mysql.com:/home/hf/work/30286/my50-30286
2007-10-05 16:33:08 +05:00
holyfoot/hf@mysql.com/hfmain.(none)
a7a6c6eb08 Bug #30955 geomfromtext() crasher.
end-of-line check missed in Gis_read_stream::get_next_word,
what can lead to crashes (expecially with NULL strings).

End-of-line check added
2007-10-03 13:35:35 +05:00
gluh@eagle.(none)
88a4df4ec0 Merge mysql.com:/home/gluh/MySQL/Merge/5.0-opt
into  mysql.com:/home/gluh/MySQL/Merge/5.1-opt
2007-09-20 14:10:05 +05:00
gluh@mysql.com/eagle.(none)
6b81174cde Bug#27747 database metadata doesn't return sufficient column default info
added get_field_default_value() function which obtains default value from the field
(used in store_create_info() & get_schema_column_record() functions)
2007-09-20 13:54:46 +05:00
gshchepa/uchum@gleb.loc
e657075fcb Merge gleb.loc:/home/uchum/work/bk/5.0-opt
into  gleb.loc:/home/uchum/work/bk/5.1-opt
2007-07-07 20:14:06 +05:00
gkodinov/kgeorge@magare.gmz
1532452a00 Bug #29166:
AsText() needs to know the maximum number of
characters a IEEE double precision value can
occupy to make sure there's enough buffer space.
The number was too small to hold all possible
values and this caused buffer overruns.
Fixed by correcting the calculation of the 
maximum digits in a string representation of an
IEEE double precision value as printed by 
String::qs_append(double).
2007-07-05 18:24:48 +03:00
anozdrin/alik@ibm.
9fae9ef66f Patch for the following bugs:
- BUG#11986: Stored routines and triggers can fail if the code
    has a non-ascii symbol
  - BUG#16291: mysqldump corrupts string-constants with non-ascii-chars
  - BUG#19443: INFORMATION_SCHEMA does not support charsets properly
  - BUG#21249: Character set of SP-var can be ignored
  - BUG#25212: Character set of string constant is ignored (stored routines)
  - BUG#25221: Character set of string constant is ignored (triggers)

There were a few general problems that caused these bugs:
1. Character set information of the original (definition) query for views,
   triggers, stored routines and events was lost.
2. mysqldump output query in client character set, which can be
   inappropriate to encode definition-query.
3. INFORMATION_SCHEMA used strings with mixed encodings to display object
   definition;

1. No query-definition-character set.

In order to compile query into execution code, some extra data (such as
environment variables or the database character set) is used. The problem
here was that this context was not preserved. So, on the next load it can
differ from the original one, thus the result will be different.

The context contains the following data:
  - client character set;
  - connection collation (character set and collation);
  - collation of the owner database;

The fix is to store this context and use it each time we parse (compile)
and execute the object (stored routine, trigger, ...).

2. Wrong mysqldump-output.

The original query can contain several encodings (by means of character set
introducers). The problem here was that we tried to convert original query
to the mysqldump-client character set.

Moreover, we stored queries in different character sets for different
objects (views, for one, used UTF8, triggers used original character set).

The solution is
  - to store definition queries in the original character set;
  - to change SHOW CREATE statement to output definition query in the
    binary character set (i.e. without any conversion);
  - introduce SHOW CREATE TRIGGER statement;
  - to dump special statements to switch the context to the original one
    before dumping and restore it afterwards.

Note, in order to preserve the database collation at the creation time,
additional ALTER DATABASE might be used (to temporary switch the database
collation back to the original value). In this case, ALTER DATABASE
privilege will be required. This is a backward-incompatible change.

3. INFORMATION_SCHEMA showed non-UTF8 strings

The fix is to generate UTF8-query during the parsing, store it in the object
and show it in the INFORMATION_SCHEMA.

Basically, the idea is to create a copy of the original query convert it to
UTF8. Character set introducers are removed and all text literals are
converted to UTF8.

This UTF8 query is intended to provide user-readable output. It must not be
used to recreate the object.  Specialized SHOW CREATE statements should be
used for this.

The reason for this limitation is the following: the original query can
contain symbols from several character sets (by means of character set
introducers).

Example:

  - original query:
    CREATE VIEW v1 AS SELECT _cp1251 'Hello' AS c1;

  - UTF8 query (for INFORMATION_SCHEMA):
    CREATE VIEW v1 AS SELECT 'Hello' AS c1;
2007-06-28 21:34:54 +04:00
evgen@moonbone.local
a52c981d6a Merge moonbone.local:/mnt/gentoo64/work/test-5.0-opt-mysql
into  moonbone.local:/mnt/gentoo64/work/test-5.1-opt-mysql
2007-06-11 00:16:00 +04:00
evgen@moonbone.local
eb9e174bc2 Bug#28763: Selecting geometry fields in UNION caused server crash.
This bug was introduced by the fix for the bug#27300. In this fix a section
of code was added to the Item::tmp_table_field_from_field_type method.
This section intended to create Field_geom fields for the Item_geometry_func
class and its descendants. In order to get the geometry type of the current
item it casted "this" to the Item_geometry_func* type. But the
Item::tmp_table_field_from_field_type method is also used for creation of
fields for UNION and in this case this method is called for an object of the
Item_type_holder class and the cast to the Item_geometry_func* type causes 
a server crash.

Now the Item::tmp_table_field_from_field_type method correctly works when it's
called for both the Item_type_holder and the Item_geometry_func classes.
The new geometry_type variable is added to the Item_type_holder class.
The new method called get_geometry_type is added to the Item_field
and the Field classes. It returns geometry type from the field for the
Item_field and the Field_geom classes and fails an assert for other Field
descendants.
2007-06-08 00:33:03 +04:00
gkodinov/kgeorge@macbook.gmz
fe03f6bbe0 Bug #27531: 5.1 part of the fix
- Renamed "Using join cache" to "Using join buffer".
- "Using join buffer" is now printed on the last
  table that "reads" from the join buffer cache.
2007-05-29 15:58:18 +03:00
gkodinov/kgeorge@magare.gmz
306371a850 bug #27531: 5.1 part of the fix:
- added join cache indication in EXPLAIN (Extra column).
 - prefer filesort over full scan over 
   index for ORDER BY (because it's faster).
 - when switching from REF to RANGE because
   RANGE uses longer key turn off sort on
   the head table only as the resulting 
   RANGE access is a candidate for join cache
   and we don't want to disable it by sorting
   on the first table only.
2007-05-04 18:06:06 +03:00
msvensson@pilot.blaudden
fc904eaead Merge pilot.blaudden:/home/msvensson/mysql/mysql-5.1
into  pilot.blaudden:/home/msvensson/mysql/mysql-5.1-maint
2007-04-02 11:15:09 +02:00
msvensson@pilot.blaudden
bb9a601829 Merge pilot.blaudden:/home/msvensson/mysql/mysql-5.0
into  pilot.blaudden:/home/msvensson/mysql/mysql-5.0-maint
2007-04-02 10:50:39 +02:00
evgen@moonbone.local
f470ac2000 Merge moonbone.local:/mnt/gentoo64/work/bk-trees/mysql-5.0-opt
into  moonbone.local:/mnt/gentoo64/work/bk-trees/mysql-5.1-opt
2007-03-31 02:42:40 +04:00
gkodinov/kgeorge@magare.gmz
c3eb3f7093 Bug #27300:
Geometry fields have a result type string and a 
  special subclass to cater for the differences
  between them and the base class (just like 
  DATE/TIME).
  When creating temporary tables for results of 
  functions that return results of type GEOMETRY
  we must construct fields of the derived class 
  instead of the base class.
  Fixed by creating a GEOMETRY field (Field_geom) 
  instead of a generic BLOB (Field_blob) in temp 
  tables for the results of GIS functions that 
  have GEOMETRY return type (Item_geometry_func).
2007-03-28 14:35:23 +03:00
gkodinov/kgeorge@magare.gmz
bd3a0ce1d9 Merge magare.gmz:/home/kgeorge/mysql/work/WL3527-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/work/WL3527-5.1-opt
2007-03-26 17:03:57 +03:00
gkodinov/kgeorge@magare.gmz
a65bc60d1a Merge magare.gmz:/home/kgeorge/mysql/work/B27164-4.1-opt
into  magare.gmz:/home/kgeorge/mysql/work/B27164-5.0-opt
2007-03-26 14:14:23 +03:00
gkodinov/kgeorge@magare.gmz[kgeorge]
e6d81ad338 Bug #27164: not reseting the data pointer
to 0 causes wrong (large) length to be read
 from the row in _mi_calc_blob_length() when 
 storing NULL values in (e.g) POINT columns.
 This large length is then used to allocate
 a block of memory that (on some OSes) causes
 trouble.
 Fixed by calling the base class's 
 Field_blob::reset() from Field_geom::reset()
 that is called when storing a NULL value into
 the column.
2007-03-26 13:17:40 +03:00
tsmith@siva.hindu.god
bd5012a8ca Merge siva.hindu.god:/home/tsmith/m/bk/maint/bmisc/50
into  siva.hindu.god:/home/tsmith/m/bk/maint/bmisc/51
2007-03-23 17:48:03 -06:00
tsmith@siva.hindu.god
47cce188b3 Bug #24563: MBROverlaps does not seem to function propertly.
Fix is to rewrite the MBR::overlaps() function, to compute the dimension of both
arguments, and the dimension of the intersection; test that all three dimensions are the
same (e.g., all are Polygons).

Add tests for all MBR* functions for various combinations of shapes, lines and points.
2007-03-23 16:28:07 -06:00
ramil/ram@ramil.myoffice.izhnet.ru
ca66f604f4 Merge mysql.com:/home/ram/work/b26038/b26038.5.0
into  mysql.com:/home/ram/work/b26038/b26038.5.1
2007-03-05 17:12:37 +04:00
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
f165316cfc after merge fix (bug #26038)
Item_func_geometry_from_text::val_str() should set null_value
in case of wrong data.
2007-03-02 15:09:44 +04:00
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
049251624a Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL
Having maybe_null flag unset for geometry/spatial functions leads to
wrong Item_func_isnull::val_int()'s results.
Fix: set maybe_null flag and add is_null() methods.
2007-02-21 14:45:19 +04:00
holyfoot/hf@hfmain.(none)
a7e4f44a25 Merge mysql.com:/home/hf/work/20691/my50-20691
into  mysql.com:/home/hf/work/20691/my51-20691
2007-02-13 01:22:43 +04:00
holyfoot/hf@mysql.com/hfmain.(none)
8299b596ae bug #20691 (INSERT (DEFAULT) may insert garbage with NO DEFAULT NOT NULL field)
Some fields (GEOMETRY first of all) can't be handled properly in this
case at all. So we return an error in this case
2007-02-12 15:41:36 +04:00