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
tk.MustExec("create table planReplayer2.t(a int, b int, INDEX ia (a), INDEX ib (b), author_id int, FOREIGN KEY (author_id) REFERENCES planReplayer.v(id) ON DELETE CASCADE);")
474
488
err=statstestutil.HandleNextDDLEventWithTxn(h)
475
489
require.NoError(t, err)
476
-
tk.MustExec("create table t(a int, b int, INDEX ia (a), INDEX ib (b), author_id int, FOREIGN KEY (author_id) REFERENCES planReplayer2.t(a) ON DELETE CASCADE) placement policy p;")
490
+
tk.MustExec("create table t(a int, b int, INDEX ia (a), INDEX ib (b), author_id int, b_id int, FOREIGN KEY (b_id) REFERENCES B(id),FOREIGN KEY (author_id) REFERENCES planReplayer2.t(a) ON DELETE CASCADE) placement policy p;")
477
491
err=statstestutil.HandleNextDDLEventWithTxn(h)
478
492
require.NoError(t, err)
479
-
493
+
// defining FKs in a circular manner
494
+
tk.MustExec(`CREATE TABLE A (
495
+
id INT AUTO_INCREMENT PRIMARY KEY,
496
+
name VARCHAR(50) NOT NULL,
497
+
b_id INT,
498
+
FOREIGN KEY (b_id) REFERENCES B(id)
499
+
);`)
500
+
err=statstestutil.HandleNextDDLEventWithTxn(h)
501
+
require.NoError(t, err)
502
+
tk.MustExec(`CREATE TABLE B (
503
+
id INT AUTO_INCREMENT PRIMARY KEY,
504
+
name VARCHAR(50) NOT NULL,
505
+
c_id INT,
506
+
FOREIGN KEY (c_id) REFERENCES C(id)
507
+
);`)
508
+
err=statstestutil.HandleNextDDLEventWithTxn(h)
509
+
require.NoError(t, err)
510
+
tk.MustExec(`CREATE TABLE C(
511
+
id INT AUTO_INCREMENT PRIMARY KEY,
512
+
name VARCHAR(50) NOT NULL,
513
+
a_id INT,
514
+
FOREIGN KEY (a_id) REFERENCES A(id)
515
+
);`)
516
+
err=statstestutil.HandleNextDDLEventWithTxn(h)
517
+
require.NoError(t, err)
518
+
tk.MustExec(`SET FOREIGN_KEY_CHECKS = 1;`)
480
519
tk.MustExec("create global binding for select a, b from t where a in (1, 2, 3) using select a, b from t use index (ib) where a in (1, 2, 3)")
481
520
rows:=tk.MustQuery("plan replayer dump explain select a, b from t where a in (1, 2, 3)")
0 commit comments