summaryrefslogtreecommitdiff
path: root/mysql-test/t/skip_grants.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t/skip_grants.test')
-rw-r--r--mysql-test/t/skip_grants.test53
1 files changed, 45 insertions, 8 deletions
diff --git a/mysql-test/t/skip_grants.test b/mysql-test/t/skip_grants.test
index 27220c9b507..93e052d8c71 100644
--- a/mysql-test/t/skip_grants.test
+++ b/mysql-test/t/skip_grants.test
@@ -9,14 +9,6 @@ drop procedure if exists f1;
use test;
#
-# test that we can create VIEW if privileges check switched off
-#
-create table t1 (field1 INT);
--- error ER_MALFORMED_DEFINER
-CREATE VIEW v1 AS SELECT field1 FROM t1;
-drop table t1;
-
-#
# Test that we can create and drop procedure without warnings
# see bug#9993
#
@@ -33,3 +25,48 @@ drop table t1;
# BUG#17595: DROP FUNCTION IF EXISTS f1 crashes server
drop function if exists f1;
+
+#
+# BUG#16777: Can not create trigger nor view w/o definer if --skip-grant-tables
+# specified
+#
+# Also, a test that we can create VIEW if privileges check switched off has
+# been moved here.
+#
+
+# Prepare.
+
+--disable_warnings
+
+DROP VIEW IF EXISTS v1;
+DROP VIEW IF EXISTS v2;
+
+DROP TABLE IF EXISTS t1;
+
+--enable_warnings
+
+# Test case.
+
+CREATE TABLE t1(c INT);
+
+CREATE TRIGGER t1_bi BEFORE INSERT ON t1
+ FOR EACH ROW
+ SET @a = 1;
+
+CREATE VIEW v1 AS SELECT * FROM t1;
+
+CREATE DEFINER=a@b TRIGGER ti_ai AFTER INSERT ON t1
+ FOR EACH ROW
+ SET @b = 1;
+
+CREATE DEFINER=a@b VIEW v2 AS SELECT * FROM t1;
+
+# Cleanup.
+
+DROP TRIGGER t1_bi;
+DROP TRIGGER ti_ai;
+
+DROP VIEW v1;
+DROP VIEW v2;
+
+DROP TABLE t1;