[Commits] Rev 3768: MDEV-5717: Server crash with insert statement containing DEFAULT into view in file:///home/bell/maria/bzr/work-maria-5.3-MDEV-5717/

sanja at montyprogram.com sanja at montyprogram.com
Wed Mar 12 12:34:17 EET 2014


At file:///home/bell/maria/bzr/work-maria-5.3-MDEV-5717/

------------------------------------------------------------
revno: 3768
revision-id: sanja at montyprogram.com-20140312103416-3v6tan06crsqry28
parent: sanja at montyprogram.com-20140307115707-poaet8iwv9d55azm
committer: sanja at montyprogram.com
branch nick: work-maria-5.3-MDEV-5717
timestamp: Wed 2014-03-12 12:34:16 +0200
message:
  MDEV-5717: Server crash with insert statement containing DEFAULT into view
  
  Item_default_value::arg can be NULL so walk() should take it into consideration.
-------------- next part --------------
=== modified file 'mysql-test/r/view.result'
--- a/mysql-test/r/view.result	2014-02-21 05:27:33 +0000
+++ b/mysql-test/r/view.result	2014-03-12 10:34:16 +0000
@@ -4790,6 +4790,22 @@ v1_field1
 deallocate prepare my_stmt;
 DROP VIEW v1,v2;
 DROP TABLE t1,t2,t3,t4;
+#
+#MDEV-5717: Server crash with insert statement containing DEFAULT into
+#view
+#
+CREATE TABLE t1 (
+`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+`test` tinyint(3) unsigned NOT NULL DEFAULT '0',
+PRIMARY KEY (`id`)
+);
+CREATE VIEW v1 AS (select  t1.id AS id,  t1.test AS test from t1);
+INSERT INTO v1 SET test = DEFAULT;
+select * from v1;
+id	test
+1	0
+drop view v1;
+drop table t1;
 # -----------------------------------------------------------------
 # -- End of 5.3 tests.
 # -----------------------------------------------------------------

=== modified file 'mysql-test/t/view.test'
--- a/mysql-test/t/view.test	2014-01-13 19:30:42 +0000
+++ b/mysql-test/t/view.test	2014-03-12 10:34:16 +0000
@@ -4720,6 +4720,25 @@ deallocate prepare my_stmt;
 DROP VIEW v1,v2;
 DROP TABLE t1,t2,t3,t4;
 
+--echo #
+--echo #MDEV-5717: Server crash with insert statement containing DEFAULT into
+--echo #view
+--echo #
+CREATE TABLE t1 (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `test` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`id`)
+);
+
+CREATE VIEW v1 AS (select  t1.id AS id,  t1.test AS test from t1);
+
+INSERT INTO v1 SET test = DEFAULT;
+
+select * from v1;
+
+drop view v1;
+drop table t1;
+
 --echo # -----------------------------------------------------------------
 --echo # -- End of 5.3 tests.
 --echo # -----------------------------------------------------------------

=== modified file 'sql/item.h'
--- a/sql/item.h	2014-02-19 13:45:33 +0000
+++ b/sql/item.h	2014-03-12 10:34:16 +0000
@@ -3551,7 +3551,7 @@ public:
 
   bool walk(Item_processor processor, bool walk_subquery, uchar *args)
   {
-    return arg->walk(processor, walk_subquery, args) ||
+    return (arg && arg->walk(processor, walk_subquery, args)) ||
       (this->*processor)(args);
   }
 



More information about the commits mailing list