@@ -95,6 +95,30 @@ func TestDDLTable(t *testing.T) {
95
95
require .Nil (t , h .Update (is ))
96
96
statsTbl = h .GetTableStats (tableInfo )
97
97
require .False (t , statsTbl .Pseudo )
98
+
99
+ // For FK table's CreateTable Event
100
+ // https://github.com/pingcap/tidb/issues/53652
101
+ testKit .MustExec ("create table t_parent (id int primary key)" )
102
+ is = do .InfoSchema ()
103
+ tbl , err = is .TableByName (model .NewCIStr ("test" ), model .NewCIStr ("t_parent" ))
104
+ require .NoError (t , err )
105
+ tableInfo = tbl .Meta ()
106
+ err = h .HandleDDLEvent (<- h .DDLEventCh ())
107
+ require .NoError (t , err )
108
+ require .Nil (t , h .Update (is ))
109
+ statsTbl = h .GetTableStats (tableInfo )
110
+ require .False (t , statsTbl .Pseudo )
111
+
112
+ 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);" )
113
+ is = do .InfoSchema ()
114
+ tbl , err = is .TableByName (model .NewCIStr ("test" ), model .NewCIStr ("t_child" ))
115
+ require .NoError (t , err )
116
+ tableInfo = tbl .Meta ()
117
+ err = h .HandleDDLEvent (<- h .DDLEventCh ())
118
+ require .NoError (t , err )
119
+ require .Nil (t , h .Update (is ))
120
+ statsTbl = h .GetTableStats (tableInfo )
121
+ require .False (t , statsTbl .Pseudo )
98
122
}
99
123
100
124
func TestDDLHistogram (t * testing.T ) {
0 commit comments