403Webshell
Server IP : 104.21.38.3  /  Your IP : 172.68.164.29
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/server/mysql/src/mysql-test/suite/ndb/t/ndb_fk_db.test
-- source include/have_ndb.inc

create database mydb0;
use mydb0;

create table parent (
  a int primary key,
  b int not null,
  c int not null,
  unique(b) using hash,
  index(c)) engine = ndb;

create database mydb1;
use mydb1;

create table child (
  a int primary key,
  b int not null,
  c int not null,
  constraint fk1 foreign key(a) references mydb0.parent (a),
  unique(b) using hash,
  index(c)) engine = ndb;

show create table child;

alter table child algorithm=copy, add constraint fk2 foreign key (b)
  references mydb0.parent(a);

show create table child;

alter table child algorithm=inplace, add constraint fk3 foreign key (c)
  references mydb0.parent(a);

show create table child;

alter table child algorithm=copy, drop foreign key fk2;

show create table child;

alter table child algorithm=inplace, drop foreign key fk3;

show create table child;

alter table mydb0.parent algorithm=copy, rename mydb1.parent;

show create table child;

alter table mydb1.parent algorithm=inplace, rename mydb0.parent;

show create table child;

use test;
alter table mydb1.child algorithm=copy, add constraint fk2 foreign key (b)
  references mydb0.parent(a);
use mydb1;
show create table child;

use test;
alter table mydb1.child algorithm=inplace, add constraint fk3 foreign key (c)
  references mydb0.parent(a);
use mydb1;
show create table child;

# bug#16286164: the fix requires correct DROP order
use test;
drop database mydb1;
drop database mydb0;

#
#
#
let $i=2;
while ($i)
{
	eval set @i=$i;
	let $engine=`select if(@i=1,'ndb','innodb')`;
	create database mydb0;
	use mydb0;
	eval create table t0 (a int primary key) engine = $engine;
	eval create table t1 (a int primary key) engine = $engine;

	alter table mydb0.t0 add constraint fk0 foreign key (a)
	      references mydb0.t1(a);

	alter table mydb0.t1 add constraint fk1 foreign key (a)
	      references mydb0.t0(a);

	drop database mydb0;

	dec $i;
}

let $i=2;
while ($i)
{
	eval set @i=$i;
	let $engine=`select if(@i=1,'ndb','innodb')`;
	create database mydb0;
	use mydb0;
	eval create table t0 (a int primary key) engine = $engine;

	create database mydb1;
	use mydb1;
	eval create table t1 (a int primary key) engine = $engine;

	alter table mydb0.t0 add constraint fk0 foreign key (a)
	      references mydb1.t1(a);

	alter table mydb1.t1 add constraint fk1 foreign key (a)
	      references mydb0.t0(a);

	--error 1217
	drop database mydb0;
	--error 1217
	drop database mydb1;

        alter table mydb0.t0 drop foreign key fk0;

	--error 1217
	drop database mydb0;

        # t1 point into mydb0, but this is ok
	drop database mydb1;
	drop database mydb0;

	dec $i;
}

Youez - 2016 - github.com/yon3zu
LinuXploit