config root man

Current Path : /home/usr.opt/mysql57/mysql-test/suite/ndb/t/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : /home/usr.opt/mysql57/mysql-test/suite/ndb/t/ndb_fk_locase.test

--source include/have_ndb.inc

--disable_query_log
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)
);
--enable_query_log

select @@global.lower_case_table_names;

--echo # 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;

--error ER_NO_REFERENCED_ROW_2
insert into t2 values (2,1);
--error ER_NO_REFERENCED_ROW_2
insert into t2 values (1,2);

--source ndb_show_tables_result.inc

select count(*) from ndb_show_tables_results
where type = "'UserTable'" and name in ( "'t1'", "'t2'");

select count(*) from ndb_show_tables_results
where type = "'ForeignKey'" and name like "'%myfk%'";

alter table T2
  drop foreign key MYfk1;

alter table t2
  drop foreign key myFK2,
  algorithm=copy;

show create table t2;

--echo # 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;

--error ER_NO_REFERENCED_ROW_2
insert into t2 values (2,1);
--error ER_NO_REFERENCED_ROW_2
insert into t2 values (1,2);

drop table t2,t1;

Man Man