You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: enginetest/queries/information_schema_queries.go
+34Lines changed: 34 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -830,6 +830,40 @@ var SkippedInfoSchemaQueries = []QueryTest{
830
830
}
831
831
832
832
varInfoSchemaScripts= []ScriptTest{
833
+
{
834
+
Name: "List triggers across multiple databases",
835
+
SetUpScript: []string{
836
+
"CREATE DATABASE db1;",
837
+
"CREATE DATABASE db2;",
838
+
"USE db1;",
839
+
"CREATE TABLE main1(pk int primary key, c1 varchar(100));",
840
+
"CREATE TABLE main2(pk int primary key);",
841
+
"CREATE TRIGGER before_insert_main1 BEFORE INSERT ON main1 FOR EACH ROW BEGIN DECLARE row_count INT; SELECT COUNT(*) INTO row_count FROM main2; IF row_count > 0 THEN SET NEW.c1 = 'has data'; ELSE SET NEW.c1 = 'empty'; END IF; END",
842
+
"USE db2;",
843
+
"CREATE TABLE b1(pk int primary key, c1 varchar(100));",
844
+
"CREATE TABLE b2(pk int primary key);",
845
+
"CREATE TRIGGER before_insert_b1 BEFORE INSERT ON b1 FOR EACH ROW BEGIN DECLARE row_count INT; SELECT COUNT(*) INTO row_count FROM b2; IF row_count > 0 THEN SET NEW.c1 = 'has data'; ELSE SET NEW.c1 = 'empty'; END IF; END",
846
+
},
847
+
Assertions: []ScriptTestAssertion{
848
+
{
849
+
Query: "USE db1;",
850
+
Expected: []sql.Row{},
851
+
},
852
+
{
853
+
Query: "SELECT database();",
854
+
Expected: []sql.Row{{"db1"}},
855
+
},
856
+
{
857
+
Query: "SELECT trigger_catalog, trigger_schema, trigger_name FROM information_schema.triggers;",
0 commit comments