summaryrefslogtreecommitdiff
path: root/mysql-test/t/select_safe.test
diff options
context:
space:
mode:
authormonty@donna.mysql.com <>2000-12-28 03:56:38 +0200
committermonty@donna.mysql.com <>2000-12-28 03:56:38 +0200
commitc0f40d14cc36f56f5b4dba288583acd345429e4e (patch)
treec27e400395741740f2e230395445236b38db27c1 /mysql-test/t/select_safe.test
parent361067e9150f7fa57d5b2ac722ed55df9c14cc53 (diff)
downloadmariadb-git-c0f40d14cc36f56f5b4dba288583acd345429e4e.tar.gz
Added support for hex strings to mysqlimport
A lot of new tests to mysqltest Fixed bug with BDB tables and autocommit
Diffstat (limited to 'mysql-test/t/select_safe.test')
-rw-r--r--mysql-test/t/select_safe.test32
1 files changed, 32 insertions, 0 deletions
diff --git a/mysql-test/t/select_safe.test b/mysql-test/t/select_safe.test
new file mode 100644
index 00000000000..e76b7558997
--- /dev/null
+++ b/mysql-test/t/select_safe.test
@@ -0,0 +1,32 @@
+#
+# test of safe selects
+#
+
+drop table if exists t1;
+SET SQL_SAFE_UPDATES=1,SQL_SELECT_LIMIT=4, SQL_MAX_JOIN_SIZE=9;
+create table t1 (a int primary key, b char(20));
+insert into t1 values(1,"test");
+SELECT SQL_BUFFER_RESULT * from t1;
+update t1 set b="a" where a=1;
+delete from t1 where a=1;
+insert into t1 values(1,"test"),(2,"test2");
+SELECT SQL_BUFFER_RESULT * from t1;
+update t1 set b="a" where a=1;
+select 1 from t1,t1 as t2,t1 as t3,t1 as t4;
+
+# The following should give errors:
+!$1175 update t1 set b="a";
+!$1175 update t1 set b="a" where b="test";
+!$1175 delete from t1;
+!$1175 delete from t1 where b="test";
+!$1175 delete from t1 where a+0=1;
+!$1104 select 1 from t1,t1 as t2,t1 as t3,t1 as t4,t1 as t5;
+
+# The following should be ok:
+update t1 set b="a" limit 1;
+update t1 set b="a" where b="b" limit 2;
+delete from t1 where b="test" limit 1;
+delete from t1 where a+0=1 limit 2;
+drop table t1;
+
+SET SQL_SAFE_UPDATES=0,SQL_SELECT_LIMIT=DEFAULT, SQL_MAX_JOIN_SIZE=DEFAULT;