Server IP : 172.67.216.182 / Your IP : 172.71.124.142 Web Server : Apache System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /www/server/mysql/src/mysql-test/suite/ndb/r/ |
Upload File : |
select @@global.lower_case_table_names; @@global.lower_case_table_names 1 # test FK name is stored lower case create table T1 ( a int primary key ) engine=ndb; insert into t1 values (1); create table T2 ( a int primary key, b int, foreign key myFK1 (a) references t1 (a), key XB (b) ) engine=ndb; alter table T2 add constraint foreign key MYfk2 (b) references test.t1 (a); show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) NOT NULL, `b` int(11) DEFAULT NULL, PRIMARY KEY (`a`), KEY `XB` (`b`), CONSTRAINT `myfk1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `myfk2` FOREIGN KEY (`b`) REFERENCES `t1` (`a`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=ndbcluster DEFAULT CHARSET=latin1 insert into t2 values (2,1); ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (Unknown error code) insert into t2 values (1,2); ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (Unknown error code) ndb_show_tables completed..... select count(*) from ndb_show_tables_results where type = "'UserTable'" and name in ( "'t1'", "'t2'"); count(*) 2 select count(*) from ndb_show_tables_results where type = "'ForeignKey'" and name like "'%myfk%'"; count(*) 2 alter table T2 drop foreign key MYfk1; alter table t2 drop foreign key myFK2, algorithm=copy; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) NOT NULL, `b` int(11) DEFAULT NULL, PRIMARY KEY (`a`), KEY `XB` (`b`) ) ENGINE=ndbcluster DEFAULT CHARSET=latin1 # test upper case parent database and table drop table T2; create table T2 ( a int primary key, b int, foreign key myFK1 (a) references T1 (a), key XB (b) ) engine=ndb; alter table T2 add constraint foreign key MYfk2 (b) references TEST.T1 (a); show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) NOT NULL, `b` int(11) DEFAULT NULL, PRIMARY KEY (`a`), KEY `XB` (`b`), CONSTRAINT `myfk1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `myfk2` FOREIGN KEY (`b`) REFERENCES `t1` (`a`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=ndbcluster DEFAULT CHARSET=latin1 insert into t2 values (2,1); ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (Unknown error code) insert into t2 values (1,2); ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (Unknown error code) drop table t2,t1;