Server IP : 104.21.38.3 / Your IP : 172.71.152.95 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/t/ |
Upload File : |
eval create table product ( category int not null, id int not null, price decimal, primary key(category, id)) engine=$engine; eval create table customer ( id int not null, primary key (id)) engine=$engine; eval create table product_order ( no int not null auto_increment, product_category int not null, product_id int not null, customer_id int not null, primary key(no), index (product_category, product_id), foreign key fk1 (product_category, product_id) references product(category, id) on update restrict on delete cascade, index (customer_id), foreign key fk2 (customer_id) references customer(id)) engine=$engine; eval create table emp ( id int primary key auto_increment, manager int, key (manager), foreign key fk1 (manager) references emp (id)) engine=$engine; select * from information_schema.table_constraints where table_schema = 'test' order by table_name, constraint_type, constraint_name; --disable_query_log select CONCAT_WS('.', TABLE_NAME, COLUMN_NAME) as COL, ORDINAL_POSITION, POSITION_IN_UNIQUE_CONSTRAINT, CONCAT_WS('.', REFERENCED_TABLE_NAME, REFERENCED_COLUMN_NAME) as REFERENCED_COL from information_schema.key_column_usage where table_schema = 'test' order by COL, ORDINAL_POSITION; --enable_query_log drop table product_order, customer, product, emp; # databases, circular, i_s.referential_constraints create database mydb1; create database mydb2; eval create table mydb1.t1 ( a1 int not null, b1 int not null, primary key using hash (a1), unique key xb1 (b1) ) engine=$engine; eval create table mydb2.t2 ( a2 int not null, b2 int not null, primary key using hash (a2), unique key xb2 (b2) ) engine=$engine; alter table mydb1.t1 add constraint fk_b1a1 foreign key (b1) references mydb1.t1 (a1), add constraint fk_b1b2 foreign key (b1) references mydb2.t2 (b2); alter table mydb2.t2 add constraint fk_b2a2 foreign key (b2) references mydb2.t2 (a2), add constraint fk_b2b1 foreign key (b2) references mydb1.t1 (b1); select * from information_schema.referential_constraints order by constraint_schema, constraint_name; select * from information_schema.table_constraints where table_schema like 'mydb%' order by table_name, constraint_type, constraint_name; select * from information_schema.key_column_usage where table_schema like 'mydb%' order by constraint_schema, constraint_name; alter table mydb1.t1 drop foreign key fk_b1a1, drop foreign key fk_b1b2; alter table mydb2.t2 drop foreign key fk_b2a2, drop foreign key fk_b2b1; drop table mydb1.t1; drop table mydb2.t2; drop database mydb1; drop database mydb2;