Debian Codegraph @

mysql-test/suite/ndb/t/ndb_fk_setdefault.test

raw
1 -- source include/have_ndb.inc
2
3 # Testing SET DEFAULT
4 # Notewhorty is that Innodb fails already at the CREATE towns which is probably better
5 # than just ignoreing the SET DEFAULT clause.
6
7 create table counties (
8 county varchar(30) not null primary key,
9 country varchar(30)
10 ) engine=ndb;
11
12 insert into counties values ('Berkshire','England'),('Shropshire','England'),
13 ('Oxfordshire','England'),('Buckinghamshire','England'),('Somewhere','Earth');
14
15 create table towns (
16 town varchar(30) not null primary key,
17 county varchar(30) default "Somewhere",
18 index county_county_index (county),
19 constraint county_town foreign key (county)
20 references counties(county) on delete set default on update restrict
21 ) engine=ndb;
22
23 insert into towns values ('Maidenhead','Berkshire'),('Reading','Berkshire'),
24 ('Shrewsbury','Shropshire'),('Oxford','Oxfordshire');
25
26 --error ER_ROW_IS_REFERENCED_2
27 delete from counties where county='Shropshire';
28 show warnings;
29
30 drop table towns, counties;