@@ -86,6 +86,30 @@ func TestDDLTable(t *testing.T) {
86
86
require .Nil (t , h .Update (is ))
87
87
statsTbl = h .GetTableStats (tableInfo )
88
88
require .False (t , statsTbl .Pseudo )
89
+
90
+ // For FK table's CreateTable Event
91
+ // https://github.com/pingcap/tidb/issues/53652
92
+ testKit .MustExec ("create table t_parent (id int primary key)" )
93
+ is = do .InfoSchema ()
94
+ tbl , err = is .TableByName (model .NewCIStr ("test" ), model .NewCIStr ("t_parent" ))
95
+ require .NoError (t , err )
96
+ tableInfo = tbl .Meta ()
97
+ err = h .HandleDDLEvent (<- h .DDLEventCh ())
98
+ require .NoError (t , err )
99
+ require .Nil (t , h .Update (is ))
100
+ statsTbl = h .GetTableStats (tableInfo )
101
+ require .False (t , statsTbl .Pseudo )
102
+
103
+ testKit .MustExec ("create table t_child (id int primary key, pid int, foreign key (pid) references t_parent(id) on delete cascade on update cascade);" )
104
+ is = do .InfoSchema ()
105
+ tbl , err = is .TableByName (model .NewCIStr ("test" ), model .NewCIStr ("t_child" ))
106
+ require .NoError (t , err )
107
+ tableInfo = tbl .Meta ()
108
+ err = h .HandleDDLEvent (<- h .DDLEventCh ())
109
+ require .NoError (t , err )
110
+ require .Nil (t , h .Update (is ))
111
+ statsTbl = h .GetTableStats (tableInfo )
112
+ require .False (t , statsTbl .Pseudo )
89
113
}
90
114
91
115
func TestCreateASystemTable (t * testing.T ) {
0 commit comments