MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:holyfoot Date:January 29 2007 9:18am
Subject:bk commit into 5.0 tree (holyfoot:1.2390) BUG#20691
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 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-01-29 13:18:10+04:00, holyfoot@stripped +3 -0
  bug #20691 (garbage specifying DEFAULT)
  
  For the geometry field accessing to the DEFAULT value should produce
  and error when no DEFAULT was specified.

  mysql-test/r/gis.result@stripped, 2007-01-29 13:18:09+04:00, holyfoot@stripped +4 -0
    result fixed

  mysql-test/t/gis.test@stripped, 2007-01-29 13:18:09+04:00, holyfoot@stripped +11 -0
    testcase

  sql/item.cc@stripped, 2007-01-29 13:18:09+04:00, holyfoot@stripped +8 -3
    we call reset() instead of 'set_default()' when there's not DEFAULT value
    specified for the field, and check if the 'reset' was succsesful

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	holyfoot
# Host:	hfmain.(none)
# Root:	/home/hf/work/20691/my50-20691

--- 1.250/sql/item.cc	2007-01-29 13:18:15 +04:00
+++ 1.251/sql/item.cc	2007-01-29 13:18:15 +04:00
@@ -5502,6 +5502,13 @@ int Item_default_value::save_in_field(Fi
   {
     if (field_arg->flags & NO_DEFAULT_VALUE_FLAG)
     {
+      if (field_arg->reset())
+      {
+        my_message(ER_CANT_CREATE_GEOMETRY_OBJECT,
+                   ER(ER_CANT_CREATE_GEOMETRY_OBJECT), MYF(0));
+        return -1;
+      }
+
       if (context->error_processor == &view_error_processor)
       {
         TABLE_LIST *view= cached_table->top_table();
@@ -5520,10 +5527,8 @@ int Item_default_value::save_in_field(Fi
                             ER(ER_NO_DEFAULT_FOR_FIELD),
                             field_arg->field_name);
       }
-      field_arg->set_default();
-      return 1;
+      return 0;
     }
-    field_arg->set_default();
     return 0;
   }
   return Item_field::save_in_field(field_arg, no_conversions);

--- 1.38/mysql-test/r/gis.result	2007-01-29 13:18:15 +04:00
+++ 1.39/mysql-test/r/gis.result	2007-01-29 13:18:15 +04:00
@@ -717,3 +717,7 @@ desc t1;
 Field	Type	Null	Key	Default	Extra
 GeomFromText('point(1 1)')	geometry	NO			
 drop table t1;
+create table t1 (g geometry not null);
+insert into t1 values(default);
+ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+drop table t1;

--- 1.31/mysql-test/t/gis.test	2007-01-29 13:18:15 +04:00
+++ 1.32/mysql-test/t/gis.test	2007-01-29 13:18:15 +04:00
@@ -428,3 +428,14 @@ drop table t1;
 create table t1 select GeomFromText('point(1 1)');
 desc t1;
 drop table t1;
+
+
+#
+# Bug #20691 (DEFAULT over NOT NULL field)
+#
+create table t1 (g geometry not null);
+--error ER_CANT_CREATE_GEOMETRY_OBJECT
+insert into t1 values(default);
+drop table t1;
+
+
Thread
bk commit into 5.0 tree (holyfoot:1.2390) BUG#20691holyfoot29 Jan