[Commits] bzr commit into Mariadb 5.2, with Maria 2.0:maria/5.2 branch (igor:2821) Bug#604549

Igor Babaev igor at askmonty.org
Tue Jul 13 00:54:15 EEST 2010


#At lp:maria/5.2 based on revid:knielsen at knielsen-hq.org-20100709120309-xzhk02q8coq7m6tl

 2821 Igor Babaev	2010-07-12
      Fixed bug #604549.
      There was no error thrown when creating a table with a virtual table
      computed by an expression returning a row.
      This caused a crash when inserting into the table.
      modified:
        mysql-test/suite/vcol/r/vcol_misc.result
        mysql-test/suite/vcol/t/vcol_misc.test
        sql/share/errmsg.txt
        sql/table.cc

=== modified file 'mysql-test/suite/vcol/r/vcol_misc.result'
--- a/mysql-test/suite/vcol/r/vcol_misc.result	2010-07-03 03:24:39 +0000
+++ b/mysql-test/suite/vcol/r/vcol_misc.result	2010-07-12 21:54:06 +0000
@@ -30,3 +30,8 @@ a	b	v
 5	50	6
 8	80	9
 drop table t1;
+CREATE TABLE t1 (
+a int NOT NULL DEFAULT '0',
+v double AS ((1, a)) VIRTUAL
+);
+ERROR HY000: Expression for computed column cannot return a row

=== modified file 'mysql-test/suite/vcol/t/vcol_misc.test'
--- a/mysql-test/suite/vcol/t/vcol_misc.test	2010-07-03 03:24:39 +0000
+++ b/mysql-test/suite/vcol/t/vcol_misc.test	2010-07-12 21:54:06 +0000
@@ -19,3 +19,17 @@ update t1 set a=v order by b limit 1;
 select * from t1 order by b;
 
 drop table t1;
+
+#
+# Bug#604549: Expression for virtual column returns row
+#             
+
+-- error ER_ROW_EXPR_FOR_VCOL 
+CREATE TABLE t1 (
+  a int NOT NULL DEFAULT '0',
+  v double AS ((1, a)) VIRTUAL
+);
+
+
+
+

=== modified file 'sql/share/errmsg.txt'
--- a/sql/share/errmsg.txt	2010-06-01 19:52:20 +0000
+++ b/sql/share/errmsg.txt	2010-07-12 21:54:06 +0000
@@ -6211,28 +6211,31 @@ ER_VCOL_BASED_ON_VCOL
         eng "A computed column cannot be based on a computed column"
 
 ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED
-        eng "Function or expression is not allowed for column '%s'."
+        eng "Function or expression is not allowed for column '%s'"
 
 ER_DATA_CONVERSION_ERROR_FOR_VIRTUAL_COLUMN
-        eng "Generated value for computed column '%s' cannot be converted to type '%s'."
+        eng "Generated value for computed column '%s' cannot be converted to type '%s'"
 
 ER_PRIMARY_KEY_BASED_ON_VIRTUAL_COLUMN
-        eng "Primary key cannot be defined upon a computed column."
+        eng "Primary key cannot be defined upon a computed column"
 
 ER_KEY_BASED_ON_GENERATED_VIRTUAL_COLUMN
-        eng "Key/Index cannot be defined on a non-stored computed column."
+        eng "Key/Index cannot be defined on a non-stored computed column"
 
 ER_WRONG_FK_OPTION_FOR_VIRTUAL_COLUMN
-        eng "Cannot define foreign key with %s clause on a computed column."
+        eng "Cannot define foreign key with %s clause on a computed column"
 
 ER_WARNING_NON_DEFAULT_VALUE_FOR_VIRTUAL_COLUMN
-        eng "The value specified for computed column '%s' in table '%s' ignored."
+        eng "The value specified for computed column '%s' in table '%s' ignored"
 
 ER_UNSUPPORTED_ACTION_ON_VIRTUAL_COLUMN
-        eng "'%s' is not yet supported for computed columns."
+        eng "'%s' is not yet supported for computed columns"
 
 ER_CONST_EXPR_IN_VCOL
-         eng "Constant expression in computed column function is not allowed."
+        eng "Constant expression in computed column function is not allowed"
+
+ER_ROW_EXPR_FOR_VCOL
+        eng "Expression for computed column cannot return a row"
 
 ER_DEBUG_SYNC_TIMEOUT
   eng "debug sync point wait timed out"

=== modified file 'sql/table.cc'
--- a/sql/table.cc	2010-06-05 14:53:36 +0000
+++ b/sql/table.cc	2010-07-12 21:54:06 +0000
@@ -1859,6 +1859,14 @@ bool fix_vcol_expr(THD *thd,
     goto end;
   }
   thd->where= save_where;
+#if 0
+#else
+  if (unlikely(func_expr->result_type() == ROW_RESULT))
+  {
+     my_error(ER_ROW_EXPR_FOR_VCOL, MYF(0));
+     goto end;
+  }
+#endif
 #ifdef PARANOID
   /*
     Walk through the Item tree checking if all items are valid



More information about the commits mailing list