Linux ip-172-26-2-223 5.4.0-1018-aws #18-Ubuntu SMP Wed Jun 24 01:15:00 UTC 2020 x86_64
Apache
: 172.26.2.223 | : 3.138.119.75
Cant Read [ /etc/named.conf ]
8.1.13
www
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
BLACK DEFEND!
README
+ Create Folder
+ Create File
/
www /
server /
mysql /
mysql-test /
suite /
ndb /
r /
[ HOME SHELL ]
Name
Size
Permission
Action
bug36547.result
455
B
-rw-r--r--
loaddata_autocom_ndb.result
740
B
-rw-r--r--
ndb_add_partition.result
13.36
KB
-rw-r--r--
ndb_addnode_restart.result
384
B
-rw-r--r--
ndb_addnode_restart2.result
454
B
-rw-r--r--
ndb_alter_table.result
19.49
KB
-rw-r--r--
ndb_alter_table2.result
685
B
-rw-r--r--
ndb_alter_table3.result
1.48
KB
-rw-r--r--
ndb_alter_table_backup.result
1.76
KB
-rw-r--r--
ndb_alter_table_dml.result
1.83
KB
-rw-r--r--
ndb_alter_table_error.result
664
B
-rw-r--r--
ndb_alter_table_online.result
29.02
KB
-rw-r--r--
ndb_alter_table_online2.result
3.21
KB
-rw-r--r--
ndb_alter_table_online_multi.r...
2
KB
-rw-r--r--
ndb_auto_increment.result
11.49
KB
-rw-r--r--
ndb_autoinc.result
2.69
KB
-rw-r--r--
ndb_backup_rate.result
912
B
-rw-r--r--
ndb_basic.result
32.68
KB
-rw-r--r--
ndb_bitfield.result
8.39
KB
-rw-r--r--
ndb_blob.result
26.47
KB
-rw-r--r--
ndb_blob_big.result
1.24
KB
-rw-r--r--
ndb_blob_partition.result
9.03
KB
-rw-r--r--
ndb_bug13563280.result
224
B
-rw-r--r--
ndb_bug14166590.result
416
B
-rw-r--r--
ndb_bug17624736.result
1.71
KB
-rw-r--r--
ndb_bug17719439.result
439
B
-rw-r--r--
ndb_bug19390895.result
1.67
KB
-rw-r--r--
ndb_bug26793.result
286
B
-rw-r--r--
ndb_bug31477.result
1.85
KB
-rw-r--r--
ndb_bulk_delete.result
1.87
KB
-rw-r--r--
ndb_bushy_joins.result
88.95
KB
-rw-r--r--
ndb_cache.result
9.35
KB
-rw-r--r--
ndb_cache2.result
13.9
KB
-rw-r--r--
ndb_cache_multi.result
2.44
KB
-rw-r--r--
ndb_cache_multi2.result
3.04
KB
-rw-r--r--
ndb_cache_trans.result
6.65
KB
-rw-r--r--
ndb_charset.result
5.77
KB
-rw-r--r--
ndb_checksum.result
38
B
-rw-r--r--
ndb_column_properties.result
16.01
KB
-rw-r--r--
ndb_condition_pushdown.result
131.71
KB
-rw-r--r--
ndb_config.result
3.36
KB
-rw-r--r--
ndb_config2.result
475
B
-rw-r--r--
ndb_create_table.result
1.02
KB
-rw-r--r--
ndb_cursor.result
792
B
-rw-r--r--
ndb_database.result
1.25
KB
-rw-r--r--
ndb_dbug_lock.result
1.64
KB
-rw-r--r--
ndb_dbug_tc_select.result
6.71
KB
-rw-r--r--
ndb_dd_alter.result
28.43
KB
-rw-r--r--
ndb_dd_basic.result
21.17
KB
-rw-r--r--
ndb_dd_bug12581213.result
334
B
-rw-r--r--
ndb_dd_ddl.result
5.94
KB
-rw-r--r--
ndb_dd_disk2memory.result
15.44
KB
-rw-r--r--
ndb_dd_dump.result
15.97
KB
-rw-r--r--
ndb_dd_initial_lg.result
941
B
-rw-r--r--
ndb_dd_restore_check_tablespac...
8.3
KB
-rw-r--r--
ndb_dd_restore_compat.result
3.73
KB
-rw-r--r--
ndb_dd_sql_features.result
22.62
KB
-rw-r--r--
ndb_ddl_open_trans.result
1.44
KB
-rw-r--r--
ndb_disconnect_ddl.result
291
B
-rw-r--r--
ndb_discover_db.result
1.92
KB
-rw-r--r--
ndb_dist_priv.result
6.36
KB
-rw-r--r--
ndb_dist_priv_bug_13340854.res...
248
B
-rw-r--r--
ndb_err4012.result
2.22
KB
-rw-r--r--
ndb_error_reporter.result
5.61
KB
-rw-r--r--
ndb_fired_trigger_shortage.res...
694
B
-rw-r--r--
ndb_fk_addnode.result
1.39
KB
-rw-r--r--
ndb_fk_alter.result
8.34
KB
-rw-r--r--
ndb_fk_bugs.result
27.58
KB
-rw-r--r--
ndb_fk_build.result
2.31
KB
-rw-r--r--
ndb_fk_cascade_delete.result
4.82
KB
-rw-r--r--
ndb_fk_cascade_delete_multi.re...
2.56
KB
-rw-r--r--
ndb_fk_cascade_update.result
1.66
KB
-rw-r--r--
ndb_fk_create_drop.result
4.8
KB
-rw-r--r--
ndb_fk_db.result
7.18
KB
-rw-r--r--
ndb_fk_deferred_cascade.result
2.82
KB
-rw-r--r--
ndb_fk_disable.result
11.64
KB
-rw-r--r--
ndb_fk_is.result
8.49
KB
-rw-r--r--
ndb_fk_locase.result
2.44
KB
-rw-r--r--
ndb_fk_locking.result
1.47
KB
-rw-r--r--
ndb_fk_multi_column.result
2.04
KB
-rw-r--r--
ndb_fk_mysqldump.result
2.93
KB
-rw-r--r--
ndb_fk_mysqldump2.result
72
B
-rw-r--r--
ndb_fk_no_fk.result
30.14
KB
-rw-r--r--
ndb_fk_no_fk_legacy.result
2.77
KB
-rw-r--r--
ndb_fk_noaction.result
5.68
KB
-rw-r--r--
ndb_fk_resources.result
2.58
KB
-rw-r--r--
ndb_fk_restore.result
14.08
KB
-rw-r--r--
ndb_fk_restrict.result
6.82
KB
-rw-r--r--
ndb_fk_self_ref.result
3.74
KB
-rw-r--r--
ndb_fk_setdefault.result
1.03
KB
-rw-r--r--
ndb_fk_setnull.result
3.23
KB
-rw-r--r--
ndb_global_schema_lock.result
3.6
KB
-rw-r--r--
ndb_global_schema_lock_error.r...
1.88
KB
-rw-r--r--
ndb_grant.result
17.65
KB
-rw-r--r--
ndb_hashmap.result
624
B
-rw-r--r--
ndb_hidden_pk.result
10.55
KB
-rw-r--r--
ndb_index.result
17.84
KB
-rw-r--r--
ndb_index_ordered.result
16.73
KB
-rw-r--r--
ndb_index_stat.result
17.74
KB
-rw-r--r--
ndb_index_stat_partitions.resu...
3.82
KB
-rw-r--r--
ndb_index_stat_restart.result
2.2
KB
-rw-r--r--
ndb_index_unique.result
20.29
KB
-rw-r--r--
ndb_insert.result
36.52
KB
-rw-r--r--
ndb_join_pushdown_bka.result
949.68
KB
-rw-r--r--
ndb_join_pushdown_default.resu...
865.61
KB
-rw-r--r--
ndb_join_pushdown_nobnl.result
864.87
KB
-rw-r--r--
ndb_join_pushdown_none.result
865.08
KB
-rw-r--r--
ndb_limit.result
1.99
KB
-rw-r--r--
ndb_load.result
2.66
KB
-rw-r--r--
ndb_loaddatalocal.result
1.57
KB
-rw-r--r--
ndb_lock.result
4.17
KB
-rw-r--r--
ndb_lock_table.result
205
B
-rw-r--r--
ndb_many_fragments.result
26.72
KB
-rw-r--r--
ndb_mgm.result
5.7
KB
-rw-r--r--
ndb_mgmd.result
198
B
-rw-r--r--
ndb_minmax.result
1.47
KB
-rw-r--r--
ndb_multi.result
8.83
KB
-rw-r--r--
ndb_multi_row.result
1.33
KB
-rw-r--r--
ndb_multi_update_delete.result
1.83
KB
-rw-r--r--
ndb_native_default_support.res...
50.29
KB
-rw-r--r--
ndb_one_fragment.result
4.05
KB
-rw-r--r--
ndb_optimize_table.result
2
KB
-rw-r--r--
ndb_optimized_node_selection.r...
1017
B
-rw-r--r--
ndb_partition_error.result
1.44
KB
-rw-r--r--
ndb_partition_error2.result
150
B
-rw-r--r--
ndb_partition_hash.result
890
B
-rw-r--r--
ndb_partition_key.result
8.82
KB
-rw-r--r--
ndb_partition_list.result
2.31
KB
-rw-r--r--
ndb_partition_range.result
7.91
KB
-rw-r--r--
ndb_print_file.result
709
B
-rw-r--r--
ndb_rbwr.result
0
B
-rw-r--r--
ndb_read_multi_range.result
15
KB
-rw-r--r--
ndb_reconnect.result
1.7
KB
-rw-r--r--
ndb_rename.result
910
B
-rw-r--r--
ndb_replace.result
3.64
KB
-rw-r--r--
ndb_restore_bug17916243.result
537
B
-rw-r--r--
ndb_restore_compat_downward.re...
132.43
KB
-rw-r--r--
ndb_restore_compat_endianness....
10.97
KB
-rw-r--r--
ndb_restore_conv_lossy_charbin...
15.46
KB
-rw-r--r--
ndb_restore_conv_lossy_integra...
20.72
KB
-rw-r--r--
ndb_restore_conv_more.result
56.57
KB
-rw-r--r--
ndb_restore_conv_padding.resul...
6.14
KB
-rw-r--r--
ndb_restore_conv_promotion.res...
23.26
KB
-rw-r--r--
ndb_restore_discover.result
540
B
-rw-r--r--
ndb_restore_misc.result
25.16
KB
-rw-r--r--
ndb_restore_print.result
9.8
KB
-rw-r--r--
ndb_restore_schema_blobs.resul...
6.44
KB
-rw-r--r--
ndb_restore_schema_partitions....
13.25
KB
-rw-r--r--
ndb_restore_schema_rewrites.re...
12.22
KB
-rw-r--r--
ndb_restore_schema_subsets.res...
95.9
KB
-rw-r--r--
ndb_restore_schema_tolerance.r...
4.53
KB
-rw-r--r--
ndb_restore_undolog.result
18.76
KB
-rw-r--r--
ndb_row_count.result
5.19
KB
-rw-r--r--
ndb_row_format.result
1.74
KB
-rw-r--r--
ndb_select_count.result
334
B
-rw-r--r--
ndb_share.result
11.29
KB
-rw-r--r--
ndb_short_sigs.result
2.54
KB
-rw-r--r--
ndb_single_user.result
4.01
KB
-rw-r--r--
ndb_sp.result
1.17
KB
-rw-r--r--
ndb_spj_dict.result
11.63
KB
-rw-r--r--
ndb_sql_allow_batching.result
918
B
-rw-r--r--
ndb_startup.result
358
B
-rw-r--r--
ndb_statistics0.result
16.23
KB
-rw-r--r--
ndb_statistics1.result
15.99
KB
-rw-r--r--
ndb_subquery.result
9.29
KB
-rw-r--r--
ndb_suma_handover.result
427
B
-rw-r--r--
ndb_temporary.result
949
B
-rw-r--r--
ndb_tmp_table_and_DDL.result
3.11
KB
-rw-r--r--
ndb_transaction.result
4.62
KB
-rw-r--r--
ndb_trigger.result
9.38
KB
-rw-r--r--
ndb_truncate.result
425
B
-rw-r--r--
ndb_types.result
4.91
KB
-rw-r--r--
ndb_update.result
2.97
KB
-rw-r--r--
ndb_update_no_read.result
11.23
KB
-rw-r--r--
ndb_view.result
597
B
-rw-r--r--
ndb_wait_until_ready.result
533
B
-rw-r--r--
ndb_wl946_main.result
19.39
KB
-rw-r--r--
ndb_wl946_post.result
3.7
KB
-rw-r--r--
ndb_wl946_pre.result
6.62
KB
-rw-r--r--
ndbapi-examples.result
3.34
KB
-rw-r--r--
ndbinfo.result
44.04
KB
-rw-r--r--
ndbinfo_cache.result
775
B
-rw-r--r--
ndbinfo_dump.result
95
B
-rw-r--r--
ndbinfo_upgrade.result
382
B
-rw-r--r--
ps_7ndb.result
103.05
KB
-rw-r--r--
strict_autoinc_5ndb.result
894
B
-rw-r--r--
wl10837.result
524
B
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : ndb_fk_no_fk.result
# Init for ndb_show_tables result CREATE TEMPORARY TABLE IF NOT EXISTS ndb_show_tables_results ( id INT, type VARCHAR(20), state VARCHAR(20), logging VARCHAR(20), _database VARCHAR(255), _schema VARCHAR(20), name VARCHAR(255) ); # # Create child tables before parents # by turning off foreign_key_checks for this session # select @@foreign_key_checks; @@foreign_key_checks 1 set @@foreign_key_checks=0; create table t1 ( pk int not null primary key, b int, foreign key (b) references t2(pk1) ) engine=ndb; create table t3 ( pk int not null primary key, b int, c int, d int, e int, f int, g int, h int, i int, j int, foreign key (b, c) references t4(pk1, pk2), foreign key (d, e, f) references t5(uk1, uk2, uk3), foreign key (g, h, i, j) references t6(oi1, oi2, oi3, oi4) ) engine=ndb; ndb_show_tables completed..... # There should be 4 mock tables created select count(*) from ndb_show_tables_results where name like "'NDB\$FKM%'"; count(*) 4 # There should be 1 mock table created for t1 select type, name from ndb_show_tables_results where name like "'NDB$FKM_<id>%'"; type name 'UserTable' 'NDB$FKM_<id>_0_t2' # There should be 3 mock tables created for t3 select type, name from ndb_show_tables_results where name like "'NDB$FKM_<id>%'" order by name; type name 'UserTable' 'NDB$FKM_<id>_0_t4' 'UserTable' 'NDB$FKM_<id>_1_t5' 'UserTable' 'NDB$FKM_<id>_2_t6' drop table t3; ndb_show_tables completed..... # There should be 1 mock table select count(*) from ndb_show_tables_results where name like "'NDB\$FKM%'"; count(*) 1 # Only t1 should have 1 mock table select type, name from ndb_show_tables_results where name like "'NDB$FKM_<id>%'"; type name 'UserTable' 'NDB$FKM_<id>_0_t2' drop table t1; # There should be 0 mock tables select count(*) from ndb_show_tables_results where name like "'NDB\$FKM%'"; count(*) 1 # # Create child table before parent # by turning off foreign_key_checks for this session # create table t1 ( pk int not null primary key, b int, foreign key (b) references t2(pk1) ) engine=ndb; create table t2 ( pk1 int not null primary key, c int ) engine=ndb; ndb_show_tables completed..... # There should be 0 mock tables select count(*) from ndb_show_tables_results where name like "'NDB\$FKM%'"; count(*) 0 # Verify that fk is working now when parent has been resolved set foreign_key_checks=1; insert into t1 values(1, 2); ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (Unknown error code) set foreign_key_checks=0; drop table t1, t2; # # Exceed table name when creating the mock table by referencing # a not yet created table with really long name # # 1) By blowing the mock_tabname buffer(currently 512 bytes) create table t1 ( pk int not null primary key, b int, foreign key (b) references abcdefghijklmnopqrstuvxyz_abcdefghijklmnopqrstuvxyz_abcdefghijklmnopqrstuvxyz_abcdefghijklmnopqrstuvxyz_abcdefghijklmnopqrstuvxyz_abcdefghijklmnopqrstuvxyz_abcdefghijklmnopqrstuvxyz_abcdefghijklmnopqrstuvxyz_abcdefghijklmnopqrstuvxyz_abcdefghijklmnopqrstuvxyz_abcdefghijklmnopqrstuvxyz_abcdefghijklmnopqrstuvxyz_abcdefghijklmnopqrstuvxyz_abcdefghijklmnopqrstuvxyz_abcdefghijklmnopqrstuvxyz_abcdefghijklmnopqrstuvxyz_abcdefghijklmnopqrstuvxyz_abcdefghijklmnopqrstuvxyz_abcdefghijklmnopqrstuvxyz_abcdefghijklmnopqrstuvxyz_(pk1) ) engine=ndb; ERROR HY000: Cannot add foreign key constraint show warnings; Level Code Message Warning 1215 Failed to create mock parent table, too long mock name Error 1215 Cannot add foreign key constraint # # show create of table with mock table references # create table t1 ( a int not null, b int not null, c int not null, primary key (a), unique key (b) using hash, key (c), constraint fk1 foreign key(a) references t2 (a), constraint fk2 foreign key(b) references t3 (a), constraint fk3 foreign key(c) references t4 (a), constraint fk4 foreign key(a) references t2 (b), constraint fk5 foreign key(b) references t3 (b), constraint fk6 foreign key(c) references t4 (b) ) engine=ndbcluster; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` int(11) NOT NULL, `c` int(11) NOT NULL, PRIMARY KEY (`a`), UNIQUE KEY `b` (`b`) USING HASH, KEY `c` (`c`), CONSTRAINT `fk1` FOREIGN KEY (`a`) REFERENCES `t2` (`a`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk2` FOREIGN KEY (`b`) REFERENCES `t3` (`a`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk3` FOREIGN KEY (`c`) REFERENCES `t4` (`a`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk4` FOREIGN KEY (`a`) REFERENCES `t2` (`b`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk5` FOREIGN KEY (`b`) REFERENCES `t3` (`b`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk6` FOREIGN KEY (`c`) REFERENCES `t4` (`b`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=ndbcluster DEFAULT CHARSET=latin1 create table t2 ( a int primary key, b int not null, c int not null, unique(b) using hash, index(c) ) engine = ndb; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` int(11) NOT NULL, `c` int(11) NOT NULL, PRIMARY KEY (`a`), UNIQUE KEY `b` (`b`) USING HASH, KEY `c` (`c`), CONSTRAINT `fk2` FOREIGN KEY (`b`) REFERENCES `t3` (`a`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk3` FOREIGN KEY (`c`) REFERENCES `t4` (`a`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk5` FOREIGN KEY (`b`) REFERENCES `t3` (`b`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk6` FOREIGN KEY (`c`) REFERENCES `t4` (`b`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk1` FOREIGN KEY (`a`) REFERENCES `t2` (`a`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk4` FOREIGN KEY (`a`) REFERENCES `t2` (`b`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=ndbcluster DEFAULT CHARSET=latin1 set @@ndb_show_foreign_key_mock_tables= 1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` int(11) NOT NULL, `c` int(11) NOT NULL, PRIMARY KEY (`a`), UNIQUE KEY `b` (`b`) USING HASH, KEY `c` (`c`), CONSTRAINT `fk2` FOREIGN KEY (`b`) REFERENCES `NDB$FKM_<child_id>_<id>_t3` (`a`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk3` FOREIGN KEY (`c`) REFERENCES `NDB$FKM_<child_id>_<id>_t4` (`a`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk5` FOREIGN KEY (`b`) REFERENCES `NDB$FKM_<child_id>_<id>_t3` (`b`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk6` FOREIGN KEY (`c`) REFERENCES `NDB$FKM_<child_id>_<id>_t4` (`b`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk1` FOREIGN KEY (`a`) REFERENCES `t2` (`a`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk4` FOREIGN KEY (`a`) REFERENCES `t2` (`b`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=ndbcluster DEFAULT CHARSET=latin1 set @@ndb_show_foreign_key_mock_tables= 0; drop table t1, t2; # # Create child table and then the parent # which does not match the fk # create table t1 ( pk int not null primary key, b int, foreign key (b) references t2(pk1) ) engine=ndb; create table t2 ( pk2 int not null primary key, c int ) engine=ndb; Warnings: Warning 1215 Could not resolve 't2' as fk parent for 'test/def/t1' since it didn't have all the referenced columns ndb_show_tables completed..... # There should be 1 mock table still select count(*) from ndb_show_tables_results where name like "'NDB\$FKM%'"; count(*) 1 drop table t1, t2; # # Create child table and then the parent # which does not match any index # create table t1 ( pk int not null primary key, b int, foreign key (b) references t2(c) ) engine=ndb; create table t2 ( pk1 int not null primary key, c int ) engine=ndb; Warnings: Warning 1215 Could not resolve 't2' as fk parent for 'test/def/t1' since no matching index could be found ndb_show_tables completed..... # There should be 1 mock table still select count(*) from ndb_show_tables_results where name like "'NDB\$FKM%'"; count(*) 1 drop table t1, t2; set @@ndb_show_foreign_key_mock_tables= 1; # # Test where FK goes from t1->t2->t3->t4 and tables are created in that order create table t1 ( pk11 int not null primary key, b int, foreign key (b) references t2(pk21) ) engine=ndb; Warnings: Warning 1003 Created mock table 'NDB$FKM_<child_id>_<id>_t2' referenced by 't1' create table t2 ( pk21 int not null primary key, b int, c int, foreign key (b, c) references t3(pk31, pk32) ) engine=ndb; Warnings: Warning 1003 Created mock table 'NDB$FKM_<child_id>_<id>_t3' referenced by 't2' Warning 1003 Dropped mock table 'NDB$FKM_<child_id>_<id>_t2' - resolved by 't2' create table t3 ( pk31 int not null, pk32 int not null, primary key(pk31, pk32), d int, e int,f int, foreign key (d,e,f) references t4(pk41, pk42, pk43) ) engine=ndb; Warnings: Warning 1003 Created mock table 'NDB$FKM_<child_id>_<id>_t4' referenced by 't3' Warning 1003 Dropped mock table 'NDB$FKM_<child_id>_<id>_t3' - resolved by 't3' create table t4 ( pk41 int not null, pk42 int not null, pk43 int not null, primary key(pk41, pk42, pk43), m varchar(55) ) engine=ndb; Warnings: Warning 1003 Dropped mock table 'NDB$FKM_<child_id>_<id>_t4' - resolved by 't4' ndb_show_tables completed..... # There should be no mock tables select count(*) from ndb_show_tables_results where name like "'NDB\$FKM%'"; count(*) 0 drop table t1, t2, t3, t4; # # Test where FK 'fans out' t1->t2 t1->t3 t1->t4, create t1 first create table t1 ( pk11 int not null primary key, b int, foreign key (b) references t2(c), d int, e int, foreign key (d, e) references t3(f, g), h varchar(55), i int, j datetime, foreign key (h, i, j) references t4(k, l, m) ) engine=ndb; Warnings: Warning 1003 Created mock table 'NDB$FKM_<child_id>_<id>_t2' referenced by 't1' Warning 1003 Created mock table 'NDB$FKM_<child_id>_<id>_t3' referenced by 't1' Warning 1003 Created mock table 'NDB$FKM_<child_id>_<id>_t4' referenced by 't1' create table t2 ( pk21 int not null primary key, c int, unique(c) ) engine=ndb; Warnings: Warning 1003 Dropped mock table 'NDB$FKM_<child_id>_<id>_t2' - resolved by 't2' create table t3 ( pk31 int not null, pk32 int not null, primary key(pk31, pk32), g int, f int, unique(f, g) ) engine=ndb; Warnings: Warning 1003 Dropped mock table 'NDB$FKM_<child_id>_<id>_t3' - resolved by 't3' create table t4 ( pk41 int not null, pk42 int not null, pk43 int not null, primary key(pk41, pk42, pk43), m varchar(55), l int, k datetime, unique(k, l, m) ) engine=ndb; Warnings: Warning 1003 Dropped mock table 'NDB$FKM_<child_id>_<id>_t4' - resolved by 't4' ndb_show_tables completed..... # There should be no mock tables select count(*) from ndb_show_tables_results where name like "'NDB\$FKM%'"; count(*) 0 drop table t1, t2, t3, t4; # # Test where FK refers to 2+ different indices in parent t1->t2(1) t1->t2(2) create table t1 ( pk11 int not null primary key, foreign key (pk11) references t2(pk21), b int, foreign key (b) references t2(c), d int, e int, foreign key (d, e) references t2(f, g), h varchar(55), i int, j datetime, foreign key (h, i, j) references t2(k, l, m) ) engine=ndb; Warnings: Warning 1003 Created mock table 'NDB$FKM_<child_id>_<id>_t2' referenced by 't1' Warning 1003 Created mock table 'NDB$FKM_<child_id>_<id>_t2' referenced by 't1' Warning 1003 Created mock table 'NDB$FKM_<child_id>_<id>_t2' referenced by 't1' Warning 1003 Created mock table 'NDB$FKM_<child_id>_<id>_t2' referenced by 't1' create table t2 ( pk21 int not null primary key, c int, unique(c), g int, f int, unique(f, g), m varchar(55), l int, k datetime, unique(k, l, m) ) engine=ndb; Warnings: Warning 1003 Dropped mock table 'NDB$FKM_<child_id>_<id>_t2' - resolved by 't2' Warning 1003 Dropped mock table 'NDB$FKM_<child_id>_<id>_t2' - resolved by 't2' Warning 1003 Dropped mock table 'NDB$FKM_<child_id>_<id>_t2' - resolved by 't2' Warning 1003 Dropped mock table 'NDB$FKM_<child_id>_<id>_t2' - resolved by 't2' ndb_show_tables completed..... # There should be no mock tables select count(*) from ndb_show_tables_results where name like "'NDB\$FKM%'"; count(*) 0 drop table t1, t2; # # Test drop of referenced table(mock table should be created) # create table t1 ( pk1 int not null primary key, foreign key (pk1) references t2(pk2), a varchar(255) ) engine=ndb; Warnings: Warning 1003 Created mock table 'NDB$FKM_<child_id>_<id>_t2' referenced by 't1' create table t2 ( pk2 int not null primary key, b datetime ) engine=ndb; Warnings: Warning 1003 Dropped mock table 'NDB$FKM_<child_id>_<id>_t2' - resolved by 't2' ndb_show_tables completed..... # There should be no mock tables select count(*) from ndb_show_tables_results where name like "'NDB\$FKM%'"; count(*) 0 drop table t2; Warnings: Warning 1003 Created mock table 'NDB$FKM_<child_id>_<id>_t2' referenced by 't1' ndb_show_tables completed..... # There should be 1 mock table created for t1 select type, name from ndb_show_tables_results where name like "'NDB$FKM_<id>%'"; type name 'UserTable' 'NDB$FKM_<id>_0_t2' drop table t1; Warnings: Warning 1003 Dropped mock table 'NDB$FKM_<child_id>_<id>_t2' - referencing table dropped ndb_show_tables completed..... # There should be no mock tables select count(*) from ndb_show_tables_results where name like "'NDB\$FKM%'"; count(*) 0 set @@ndb_show_foreign_key_mock_tables= 0; # # Test mock tables in different databases, mock table # should be created in same database as the real parent would. # set @@ndb_show_foreign_key_mock_tables= 1; create database mydb0; create database mydb1; create table mydb1.t1 ( a int primary key, constraint fk1 foreign key(a) references mydb0.t2(a) ) engine = ndb; Warnings: Warning 1003 Created mock table 'NDB$FKM_<child_id>_<id>_t2' referenced by 't1' ndb_show_tables completed..... # There should be 1 mock table created for t1 select type, _database, name from ndb_show_tables_results where name like "'NDB$FKM_<id>%'"; type _database name 'UserTable' 'mydb0' 'NDB$FKM_<id>_0_t2' drop table mydb1.t1; Warnings: Warning 1003 Dropped mock table 'NDB$FKM_<child_id>_<id>_t2' - referencing table dropped ndb_show_tables completed..... # There should be no mock tables select count(*) from ndb_show_tables_results where name like "'NDB\$FKM%'"; count(*) 0 create table mydb1.t1 ( a int primary key, constraint fk1 foreign key(a) references mydb0.t2(a) ) engine = ndb; Warnings: Warning 1003 Created mock table 'NDB$FKM_<child_id>_<id>_t2' referenced by 't1' create table mydb0.t2 ( a int primary key ) engine = ndb; Warnings: Warning 1003 Dropped mock table 'NDB$FKM_<child_id>_<id>_t2' - resolved by 't2' ndb_show_tables completed..... # There should be no mock tables select count(*) from ndb_show_tables_results where name like "'NDB\$FKM%'"; count(*) 0 # Drop child then parent drop table mydb1.t1; drop table mydb0.t2; create table mydb1.t1 ( a int primary key, constraint fk1 foreign key(a) references mydb0.t2(a) ) engine = ndb; Warnings: Warning 1003 Created mock table 'NDB$FKM_<child_id>_<id>_t2' referenced by 't1' create table mydb0.t2 ( a int primary key ) engine = ndb; Warnings: Warning 1003 Dropped mock table 'NDB$FKM_<child_id>_<id>_t2' - resolved by 't2' ndb_show_tables completed..... # There should be no mock tables select count(*) from ndb_show_tables_results where name like "'NDB\$FKM%'"; count(*) 0 # Drop parent then child(creates mock which is then dropped) drop table mydb0.t2; Warnings: Warning 1003 Created mock table 'NDB$FKM_<child_id>_<id>_t2' referenced by 't1' drop table mydb1.t1; Warnings: Warning 1003 Dropped mock table 'NDB$FKM_<child_id>_<id>_t2' - referencing table dropped ndb_show_tables completed..... # There should be no mock tables select count(*) from ndb_show_tables_results where name like "'NDB\$FKM%'"; count(*) 0 # # Create spagetthi foreign keys between tables in three different databases # create table t1 ( pk int not null primary key, b int, foreign key (b) references mydb1.t2(pk1), c int, unique(c), j int, foreign key (j) references mydb0.t3(pk2), k int, foreign key (k) references mydb0.t1(pk5), l int, foreign key (l) references mydb1.t1(pk6), y int, foreign key (y) references mydb1.t1(z) ) engine=ndb; Warnings: Warning 1003 Created mock table 'NDB$FKM_<child_id>_<id>_t1' referenced by 't1' Warning 1003 Created mock table 'NDB$FKM_<child_id>_<id>_t1' referenced by 't1' Warning 1003 Created mock table 'NDB$FKM_<child_id>_<id>_t1' referenced by 't1' Warning 1003 Created mock table 'NDB$FKM_<child_id>_<id>_t2' referenced by 't1' Warning 1003 Created mock table 'NDB$FKM_<child_id>_<id>_t3' referenced by 't1' create table mydb1.t2 ( pk1 int not null primary key, d int, foreign key (d) references mydb0.t3(pk2) ) engine=ndb; Warnings: Warning 1003 Created mock table 'NDB$FKM_<child_id>_<id>_t3' referenced by 't2' Warning 1003 Dropped mock table 'NDB$FKM_<child_id>_<id>_t2' - resolved by 't2' create table mydb0.t3 ( pk2 int not null primary key, e int, foreign key (e) references test.t1(c) ) engine=ndb; Warnings: Warning 1003 Dropped mock table 'NDB$FKM_<child_id>_<id>_t3' - resolved by 't3' Warning 1003 Dropped mock table 'NDB$FKM_<child_id>_<id>_t3' - resolved by 't3' create table mydb0.t4 ( pk3 int not null primary key, f int, foreign key (f) references t3(pk2) ) engine=ndb; create table mydb0.t5 ( pk4 int not null primary key, g int, foreign key (g) references test.t1(pk), h int, foreign key (h) references mydb1.t2(pk1), i int, foreign key (i) references mydb0.t3(pk2) ) engine=ndb; create table mydb0.t1 ( pk5 int not null primary key, m int, foreign key (m) references test.t1(pk), n int, foreign key (n) references mydb1.t2(pk1), o int, foreign key (o) references mydb0.t3(pk2) ) engine=ndb; Warnings: Warning 1003 Dropped mock table 'NDB$FKM_<child_id>_<id>_t1' - resolved by 't1' create table mydb1.t1 ( pk6 int not null primary key, p int, foreign key (p) references test.t1(pk), q int, foreign key (q) references mydb1.t2(pk1), x int, foreign key (x) references mydb0.t3(pk2), z int, unique(z) ) engine=ndb; Warnings: Warning 1003 Dropped mock table 'NDB$FKM_<child_id>_<id>_t1' - resolved by 't1' Warning 1003 Dropped mock table 'NDB$FKM_<child_id>_<id>_t1' - resolved by 't1' set @@ndb_show_foreign_key_mock_tables= 0; ndb_show_tables completed..... # There should be no mock tables select count(*) from ndb_show_tables_results where name like "'NDB\$FKM%'"; count(*) 0 # Drop the database mydb0 with all tables still there drop database mydb0; ndb_show_tables completed..... # There should be 4 mock tables created by dropping mydb0 select count(*) from ndb_show_tables_results where name like "'NDB\$FKM%'"; count(*) 4 # Drop also database mydb1 drop database mydb1; ndb_show_tables completed..... # There should be 5 mock tables all referenced by test.t1 select count(*) from ndb_show_tables_results where name like "'NDB\$FKM%'"; count(*) 5 # Drop t1 and the 5 remaining mocks drop table t1; ndb_show_tables completed..... # There should be no mock tables select count(*) from ndb_show_tables_results where name like "'NDB\$FKM%'"; count(*) 0 # # ALTER a table which references mock parent # create table t1 ( pk int not null primary key, b int, foreign key (b) references t2(pk1) ) engine=ndb; ndb_show_tables completed..... # There should be one mock table in place of t2 select name from ndb_show_tables_results where name like "'NDB\$FKM%'"; name 'NDB$FKM_<child_id>_<id>_t2' alter table t1 add column c int; Warnings: Warning 1478 Converted FIXED field 'c' to DYNAMIC to enable on-line ADD COLUMN ndb_show_tables completed..... # There should be one mock table still select name from ndb_show_tables_results where name like "'NDB\$FKM%'"; name 'NDB$FKM_<child_id>_<id>_t2' alter table t1 algorithm = copy, add column d int not null; ndb_show_tables completed..... # There should be one mock table still select name from ndb_show_tables_results where name like "'NDB\$FKM%'"; name 'NDB$FKM_<child_id>_<id>_t2' drop table t1; ndb_show_tables completed..... # There should be no mock tables select count(*) from ndb_show_tables_results where name like "'NDB\$FKM%'"; count(*) 0 # # Alter table to add foreign keys referencing non existing parents. One # new mock should be created per fk # create table child ( a int primary key auto_increment, b int not null, c int not null, unique(b) using hash, index(c) ) engine = ndb; alter table child algorithm=inplace, add constraint fk1 foreign key (a) references parent(a); alter table child algorithm=inplace, add constraint fk2 foreign key (b) references parent(col1); alter table child algorithm=inplace, add constraint fk3 foreign key (c) references parent(col2); alter table child algorithm=inplace, add constraint fk4 foreign key (c) references parent(col3), add constraint fk5 foreign key (c) references parent(col4), add constraint fk6 foreign key (c) references parent(col5); ndb_show_tables completed..... # There should be 6 mock tables select name from ndb_show_tables_results where name like "'NDB\$FKM%'"; name 'NDB$FKM_<child_id>_<id>_parent' 'NDB$FKM_<child_id>_<id>_parent' 'NDB$FKM_<child_id>_<id>_parent' 'NDB$FKM_<child_id>_<id>_parent' 'NDB$FKM_<child_id>_<id>_parent' 'NDB$FKM_<child_id>_<id>_parent' alter table child algorithm=inplace, drop foreign key fk1; ndb_show_tables completed..... # There should be 5 mock tables select name from ndb_show_tables_results where name like "'NDB\$FKM%'"; name 'NDB$FKM_<child_id>_<id>_parent' 'NDB$FKM_<child_id>_<id>_parent' 'NDB$FKM_<child_id>_<id>_parent' 'NDB$FKM_<child_id>_<id>_parent' 'NDB$FKM_<child_id>_<id>_parent' alter table child algorithm=inplace, drop foreign key fk3, drop foreign key fk4, drop foreign key fk6; ndb_show_tables completed..... # There should be 2 mock tables left select name from ndb_show_tables_results where name like "'NDB\$FKM%'"; name 'NDB$FKM_<child_id>_<id>_parent' 'NDB$FKM_<child_id>_<id>_parent' drop table child; ndb_show_tables completed..... # There should be no mock tables select count(*) from ndb_show_tables_results where name like "'NDB\$FKM%'"; count(*) 0 # # Alter table into place(i.e rename) as new parent, should remove # the mock table # create table t1 ( pk1 int not null primary key, b int, foreign key (b) references t2(pk2) ) engine=ndb; create table t3 ( pk2 int not null primary key, b int ) engine=ndb; ndb_show_tables completed..... # There should be one mock table for t1 select count(*) from ndb_show_tables_results where name like "'NDB\$FKM%'"; count(*) 1 set @@ndb_show_foreign_key_mock_tables= 1; alter table t3 rename t2; Warnings: Warning 1003 Dropped mock table 'NDB$FKM_<child_id>_<id>_t2' - resolved by 't2' set @@ndb_show_foreign_key_mock_tables= 0; alter table t2 rename t3; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `pk1` int(11) NOT NULL, `b` int(11) DEFAULT NULL, PRIMARY KEY (`pk1`), KEY `b` (`b`), CONSTRAINT `FK_<child_id>_<id>` FOREIGN KEY (`b`) REFERENCES `t3` (`pk2`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=ndbcluster DEFAULT CHARSET=latin1 drop table t3; create table t2 ( pk2 int not null primary key, b int ) engine=ndb; ndb_show_tables completed..... # There should be one mock table for t1 select count(*) from ndb_show_tables_results where name like "'NDB\$FKM%'"; count(*) 1 set @@ndb_show_foreign_key_mock_tables= 1; alter table t2 algorithm=inplace, rename t3; Warnings: Warning 1003 Dropped mock table 'NDB$FKM_<child_id>_<id>_t3' - resolved by 't3' set @@ndb_show_foreign_key_mock_tables= 0; ndb_show_tables completed..... # There should be no mock tables select count(*) from ndb_show_tables_results where name like "'NDB\$FKM%'"; count(*) 0 drop table t3, t1; # # Truncating table which references mock table # create table t1 ( pk1 int not null primary key, b int, foreign key fk1 (b) references t2(pk2) ) engine=ndb; set foreign_key_checks=1; truncate table t1; set foreign_key_checks=0; set @@ndb_show_foreign_key_mock_tables= 1; truncate table t1; set @@ndb_show_foreign_key_mock_tables= 0; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `pk1` int(11) NOT NULL, `b` int(11) DEFAULT NULL, PRIMARY KEY (`pk1`), KEY `fk1` (`b`), CONSTRAINT `fk1` FOREIGN KEY (`b`) REFERENCES `t2` (`pk2`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=ndbcluster DEFAULT CHARSET=latin1 drop table t1; # # Truncating referenced table -> not allowed # create table t2 ( pk2 int not null primary key, c int ) engine=ndb; create table t1 ( pk1 int not null primary key, b int, foreign key (b) references t2(pk2) ) engine=ndb; set foreign_key_checks=1; truncate table t2; ERROR 42000: Cannot truncate a table referenced in a foreign key constraint () set foreign_key_checks=0; truncate table t2; ERROR 42000: Cannot truncate a table referenced in a foreign key constraint () drop table t1, t2; # # Truncating referenced table which references # another table -> not allowed # create table t3 ( pk3 int not null primary key, d int ) engine=ndb; create table t2 ( pk2 int not null primary key, c int, foreign key (c) references t3(pk3) ) engine=ndb; create table t1 ( pk1 int not null primary key, b int, foreign key (b) references t2(pk2) ) engine=ndb; set foreign_key_checks=1; truncate table t2; ERROR 42000: Cannot truncate a table referenced in a foreign key constraint () set foreign_key_checks=0; truncate table t2; ERROR 42000: Cannot truncate a table referenced in a foreign key constraint () drop table t1, t2, t3; # # Truncating referencing table # create table t2 ( pk2 int not null primary key, c int ) engine=ndb; create table t1 ( pk1 int not null primary key, b int, foreign key fk1 (b) references t2(pk2) ) engine=ndb; set @@ndb_show_foreign_key_mock_tables= 1; set foreign_key_checks=1; truncate table t1; set foreign_key_checks=0; truncate table t1; set @@ndb_show_foreign_key_mock_tables= 0; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `pk1` int(11) NOT NULL, `b` int(11) DEFAULT NULL, PRIMARY KEY (`pk1`), KEY `fk1` (`b`), CONSTRAINT `fk1` FOREIGN KEY (`b`) REFERENCES `t2` (`pk2`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=ndbcluster DEFAULT CHARSET=latin1 drop table t1, t2; # # Truncate with multiple foreign keys # create table t2 ( pk2 int not null primary key, c int ) engine=ndb; create table t1 ( pk1 int not null primary key, b int, c int, d int, e int, foreign key fk1 (b) references t2(pk2), foreign key fk2 (c) references t3(pk3), foreign key fk3 (d) references t3(pk4), foreign key fk4 (e) references t4(pk5) ) engine=ndb; set @@ndb_show_foreign_key_mock_tables= 1; set foreign_key_checks=1; truncate table t1; set foreign_key_checks=0; truncate table t1; set @@ndb_show_foreign_key_mock_tables= 0; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `pk1` int(11) NOT NULL, `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL, `d` int(11) DEFAULT NULL, `e` int(11) DEFAULT NULL, PRIMARY KEY (`pk1`), KEY `fk1` (`b`), KEY `fk2` (`c`), KEY `fk3` (`d`), KEY `fk4` (`e`), CONSTRAINT `fk1` FOREIGN KEY (`b`) REFERENCES `t2` (`pk2`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk2` FOREIGN KEY (`c`) REFERENCES `t3` (`pk3`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk3` FOREIGN KEY (`d`) REFERENCES `t3` (`pk4`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk4` FOREIGN KEY (`e`) REFERENCES `t4` (`pk5`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=ndbcluster DEFAULT CHARSET=latin1 drop table t1, t2; # # Create child table referencing mock parent, insert data and # then create the real parent (like mysqldump does it) # CREATE TABLE `address` ( `no` int(11) NOT NULL AUTO_INCREMENT, `type` int(11) NOT NULL DEFAULT '37', `customer_id` int(11) NOT NULL, `street` varchar(255) DEFAULT NULL, `country` int(11) DEFAULT NULL, PRIMARY KEY (`no`), KEY `ca_fk1` (`customer_id`), CONSTRAINT `ca_fk1` FOREIGN KEY(`customer_id`) REFERENCES `customer` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT ) ENGINE=ndbcluster AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; INSERT INTO `address` VALUES (1,37,1,'Main st. 1215',48); CREATE TABLE `customer` ( `id` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=ndbcluster DEFAULT CHARSET=latin1; # Check DML insert into address (type, customer_id, street, country) values (38,2,'Second st. 2326',49 ); insert into address (type, customer_id, street, country) values (39,1,'Third st. 3437',50 ); update address set country=50 where no=2; insert into customer values(1); # Check DML with foreign_key_checks on set foreign_key_checks=1; update address set customer_id = 3 where no = 1; ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (Unknown error code) delete from customer where id = 1; select no, type, customer_id from address; no type customer_id 2 38 2 set foreign_key_checks=0; drop table address, customer; # # Create child table referencing real parent, insert data # and then create fk(like mysqldump does not do it) # CREATE TABLE `customer` ( `id` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=ndbcluster DEFAULT CHARSET=latin1; INSERT INTO `customer` VALUES (1); CREATE TABLE `address` ( `no` int(11) NOT NULL AUTO_INCREMENT, `type` int(11) NOT NULL DEFAULT '37', `customer_id` int(11) NOT NULL, `street` varchar(255) DEFAULT NULL, `country` int(11) DEFAULT NULL, PRIMARY KEY (`no`), KEY `ca_fk1` (`customer_id`) ) ENGINE=ndbcluster AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; INSERT INTO `address` VALUES (1,37,1,'Main st. 1215',48); INSERT INTO `address` VALUES (2,22,2,'Second st. 2222',2); # Add fk inplace set foreign_key_checks=1; ALTER TABLE address ALGORITHM=inplace, ADD CONSTRAINT `ca_fk1` FOREIGN KEY(`customer_id`) REFERENCES `customer` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT; ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (Unknown error code) set foreign_key_checks=0; ALTER TABLE address ALGORITHM=inplace, ADD CONSTRAINT `ca_fk1` FOREIGN KEY(`customer_id`) REFERENCES `customer` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT; # Add another fk copying set foreign_key_checks=1; ALTER TABLE address ALGORITHM=copy, ADD CONSTRAINT `ca_fk2` FOREIGN KEY(`customer_id`) REFERENCES `customer` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT; ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (Unknown error code) set foreign_key_checks=0; ALTER TABLE address ALGORITHM=copy, ADD CONSTRAINT `ca_fk2` FOREIGN KEY(`customer_id`) REFERENCES `customer` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT; ALTER TABLE address ALGORITHM=inplace, ADD COLUMN a int COLUMN_FORMAT DYNAMIC; ALTER TABLE address ALGORITHM=copy, ADD COLUMN b int not null; # Check DML with foreign_key_checks on set foreign_key_checks=1; update address set customer_id = 3 where no = 1; ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (Unknown error code) update address set customer_id = 1 where no = 2; delete from customer where id = 1; select count(*) from address; count(*) 0 set foreign_key_checks=0; drop table address, customer;
Close