List:Commits« Previous MessageNext Message »
From:holyfoot Date:November 13 2007 7:51am
Subject:bk commit into 4.1 tree (holyfoot:1.2688) BUG#31158
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of hf. When hf does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-11-13 10:51:47+04:00, holyfoot@stripped +5 -0
  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.

  mysql-test/r/gis.result@stripped, 2007-11-13 10:51:47+04:00, holyfoot@stripped +25 -1
    Bug #31158  Spatial, Union, LONGBLOB vs BLOB bug (crops data)
    
    test result

  mysql-test/t/gis.test@stripped, 2007-11-13 10:51:47+04:00, holyfoot@stripped +31 -0
    Bug #31158  Spatial, Union, LONGBLOB vs BLOB bug (crops data)
    
    test case

  sql/field.cc@stripped, 2007-11-13 10:51:47+04:00, holyfoot@stripped +1 -1
    Bug #31158  Spatial, Union, LONGBLOB vs BLOB bug (crops data)
    
    max_field_size used instead of numeric value

  sql/field.h@stripped, 2007-11-13 10:51:47+04:00, holyfoot@stripped +1 -0
    Bug #31158  Spatial, Union, LONGBLOB vs BLOB bug (crops data)
    
    max_field_size constant defined

  sql/item_geofunc.cc@stripped, 2007-11-13 10:51:47+04:00, holyfoot@stripped +1 -1
    Bug #31158  Spatial, Union, LONGBLOB vs BLOB bug (crops data)
    
    max_length parameter fixed

diff -Nrup a/mysql-test/r/gis.result b/mysql-test/r/gis.result
--- a/mysql-test/r/gis.result	2007-10-03 13:35:33 +05:00
+++ b/mysql-test/r/gis.result	2007-11-13 10:51:47 +04:00
@@ -668,7 +668,7 @@ def	test	t1	t1	g	g	255	4294967295	0	Y	14
 g
 select asbinary(g) from t1;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max
length	Is_null	Flags	Decimals	Charsetnr
-def					asbinary(g)	252	8192	0	Y	128	0	63
+def					asbinary(g)	252	4294967295	0	Y	128	0	63
 asbinary(g)
 drop table t1;
 create table t1 (a TEXT, b GEOMETRY NOT NULL, SPATIAL KEY(b));
@@ -730,4 +730,28 @@ select geomfromtext(col9,col89) as a fro
 a
 NULL
 DROP TABLE t1;
+CREATE TABLE t1 (
+geomdata polygon NOT NULL,
+SPATIAL KEY index_geom (geomdata)
+) ENGINE=MyISAM DEFAULT CHARSET=latin2 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED;
+CREATE TABLE t2 (
+geomdata polygon NOT NULL,
+SPATIAL KEY index_geom (geomdata)
+) ENGINE=MyISAM DEFAULT CHARSET=latin2 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED;
+CREATE TABLE t3
+select 
+aswkb(ws.geomdata) AS geomdatawkb 
+from 
+t1 ws
+union 
+select 
+aswkb(ws.geomdata) AS geomdatawkb 
+from 
+t2 ws;
+describe t3;
+Field	Type	Null	Key	Default	Extra
+geomdatawkb	longblob	YES		NULL	
+drop table t1;
+drop table t2;
+drop table t3;
 End of 4.1 tests
diff -Nrup a/mysql-test/t/gis.test b/mysql-test/t/gis.test
--- a/mysql-test/t/gis.test	2007-10-03 13:35:33 +05:00
+++ b/mysql-test/t/gis.test	2007-11-13 10:51:47 +04:00
@@ -427,4 +427,35 @@ INSERT INTO `t1` VALUES ('','0000-00-00'
 select geomfromtext(col9,col89) as a from t1;
 DROP TABLE t1;
 
+#
+# Bug #31158 Spatial, Union, LONGBLOB vs BLOB bug (crops data) 
+#
+
+CREATE TABLE t1 (
+  geomdata polygon NOT NULL,
+  SPATIAL KEY index_geom (geomdata)
+) ENGINE=MyISAM DEFAULT CHARSET=latin2 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED;
+
+CREATE TABLE t2 (
+  geomdata polygon NOT NULL,
+  SPATIAL KEY index_geom (geomdata)
+) ENGINE=MyISAM DEFAULT CHARSET=latin2 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED;
+
+CREATE TABLE t3
+select 
+    aswkb(ws.geomdata) AS geomdatawkb 
+  from 
+    t1 ws
+union 
+  select 
+    aswkb(ws.geomdata) AS geomdatawkb 
+  from 
+    t2 ws;
+
+describe t3;
+
+drop table t1;
+drop table t2;
+drop table t3;
+
 --echo End of 4.1 tests
diff -Nrup a/sql/field.cc b/sql/field.cc
--- a/sql/field.cc	2007-10-04 15:22:30 +05:00
+++ b/sql/field.cc	2007-11-13 10:51:47 +04:00
@@ -6975,7 +6975,7 @@ uint32 Field_blob::max_length()
   case 3:
     return 16777215 * field_charset->mbmaxlen;
   case 4:
-    return (uint32) 4294967295U;
+    return max_field_size;
   default:
     DBUG_ASSERT(0); // we should never go here
     return 0;
diff -Nrup a/sql/field.h b/sql/field.h
--- a/sql/field.h	2007-04-29 04:15:39 +05:00
+++ b/sql/field.h	2007-11-13 10:51:47 +04:00
@@ -26,6 +26,7 @@
 
 #define NOT_FIXED_DEC			31
 #define DATETIME_DEC                     6
+const uint32 max_field_size= (uint32) 4294967295U;
 
 class Send_field;
 class Protocol;
diff -Nrup a/sql/item_geofunc.cc b/sql/item_geofunc.cc
--- a/sql/item_geofunc.cc	2007-02-21 14:45:18 +04:00
+++ b/sql/item_geofunc.cc	2007-11-13 10:51:47 +04:00
@@ -29,7 +29,7 @@ void Item_geometry_func::fix_length_and_
 {
   collation.set(&my_charset_bin);
   decimals=0;
-  max_length=MAX_BLOB_WIDTH;
+  max_length= max_field_size;
   maybe_null= 1;
 }
 
Thread
bk commit into 4.1 tree (holyfoot:1.2688) BUG#31158holyfoot13 Nov