summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <ramil/ram@mysql.com/ramil.myoffice.izhnet.ru>2007-11-07 12:47:19 +0400
committerunknown <ramil/ram@mysql.com/ramil.myoffice.izhnet.ru>2007-11-07 12:47:19 +0400
commitc7191f90a3634b1a0cc45dc76f16b254f3e0a18e (patch)
tree7351c8e3f9ab9c861061348129e82957e949c08b /mysql-test
parentab4f08b39e585193587b82b4ac461ca797ad7393 (diff)
downloadmariadb-git-c7191f90a3634b1a0cc45dc76f16b254f3e0a18e.tar.gz
Fix for bug #32137: prepared statement crash with str_to_date in update clause
Problem: calling non-constant argument's val_xxx() methods in the ::fix_length_and_dec() is inadmissible. Fix: call the method only for constant arguments. mysql-test/r/ps.result: Fix for bug #32137: prepared statement crash with str_to_date in update clause - test result. mysql-test/t/ps.test: Fix for bug #32137: prepared statement crash with str_to_date in update clause - test case. sql/item_timefunc.cc: Fix for bug #32137: prepared statement crash with str_to_date in update clause - call argument's val_str() only for constant items in the Item_func_str_to_date::fix_length_and_dec().
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/ps.result5
-rw-r--r--mysql-test/t/ps.test9
2 files changed, 14 insertions, 0 deletions
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index 49e4bf2f318..49643dd3f78 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -1109,4 +1109,9 @@ a
13
DEALLOCATE PREPARE st1;
DROP TABLE t1;
+create table t1 (a int, b tinyint);
+prepare st1 from 'update t1 set b= (str_to_date(a, a))';
+execute st1;
+deallocate prepare st1;
+drop table t1;
End of 4.1 tests.
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index 5e5dcc36b19..18beb357d05 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -1146,4 +1146,13 @@ EXECUTE st1;
DEALLOCATE PREPARE st1;
DROP TABLE t1;
+#
+# Bug #32137: prepared statement crash with str_to_date in update clause
+#
+create table t1 (a int, b tinyint);
+prepare st1 from 'update t1 set b= (str_to_date(a, a))';
+execute st1;
+deallocate prepare st1;
+drop table t1;
+
--echo End of 4.1 tests.