Debian Codegraph @

mysql-test/suite/ndb/r/ndb_restore_conv_null.result

raw
1 Test nullable <-> not-null conversions in data restore in ndb_restore
2 create table nullable_no_nulls (
3 id int primary key,
4 col1 int unsigned,
5 col2 varchar(20),
6 col3 text,
7 col4 date) engine=ndb;
8 create table nullable_with_nulls (
9 id int primary key,
10 col1 int unsigned,
11 col2 varchar(20),
12 col3 text,
13 col4 date) engine=ndb;
14 create table not_nullable_no_nulls (
15 id int primary key,
16 col1 int unsigned not null,
17 col2 varchar(20) not null,
18 col3 text not null,
19 col4 date not null)engine=ndb;
20 # run backup
21 drop table nullable_no_nulls;
22 drop table nullable_with_nulls;
23 drop table not_nullable_no_nulls;
24 # conversion from nullable -> not null with no NULLs in table
25 create table nullable_no_nulls (
26 id int primary key,
27 col1 int unsigned not null,
28 col2 varchar(20) not null,
29 col3 text not null,
30 col4 date not null)engine=ndb;
31 # conversion from nullable -> not null with NULLs in table
32 create table nullable_with_nulls (
33 id int primary key not null,
34 col1 int unsigned not null,
35 col2 varchar(20) not null,
36 col3 text not null,
37 col4 date not null) engine=ndb;
38 # conversion from not-null -> nullable
39 create table not_nullable_no_nulls (
40 id int primary key,
41 col1 int unsigned,
42 col2 varchar(20),
43 col3 text,
44 col4 date)engine=ndb;
45 # cannot restore nullable->non-nullable without --lossy-conversions
46 # can restore nullable->non-nullable if non-nullable col has no NULL values
47 # cannot restore nullable->non-nullable if non-nullable col has NULL values
48 # cannot restore not-null->non-nullable without --promote-attributes
49 # can restore not-null->nullable
50 select count(*) from nullable_no_nulls where col2=REPEAT("abcde", 4) and col3=REPEAT("XYZ", 2000) and col4="2021-04-01";
51 count(*)
52 100
53 select count(*) from nullable_with_nulls;
54 count(*)
55 0
56 select count(*) from not_nullable_no_nulls where col2=REPEAT("abcde", 4) and col3=REPEAT("XYZ", 2000) and col4="2021-04-01";
57 count(*)
58 100
59 drop table nullable_no_nulls;
60 drop table nullable_with_nulls;
61 drop table not_nullable_no_nulls;
62 Test nullable <-> not-null conversions in log replay in ndb_restore
63 create table nullable (
64 id int primary key,
65 col1 int unsigned,
66 col2 varchar(20),
67 col3 text,
68 col4 date) engine=ndb;
69 Cause backup stall
70
71 Starting backup
72 Backup started
73 update nullable set col2=NULL;
74
75 Waiting for backup to complete
76 Backup completed
77 drop table nullable;
78 # conversion from nullable -> not null
79 create table nullable (
80 id int primary key,
81 col1 int unsigned not null,
82 col2 varchar(20) not null,
83 col3 text not null,
84 col4 date not null)engine=ndb;
85 # cannot restore nullable->non-nullable if backup log sets NULL values
86 select * from nullable;
87 id col1 col2 col3 col4
88 drop table nullable;