| 1 |
-- source include/have_ndb.inc |
| 2 |
|
| 3 |
# |
| 4 |
# some negative tests |
| 5 |
# |
| 6 |
|
| 7 |
# cannot have ROW_FORMAT=FIXED and var attrs mixed |
| 8 |
CREATE TABLE t1 ( |
| 9 |
a INT KEY, |
| 10 |
b VARCHAR(10) |
| 11 |
) |
| 12 |
ROW_FORMAT=FIXED |
| 13 |
ENGINE=NDB; |
| 14 |
|
| 15 |
# warnings give more detail on the conflict |
| 16 |
SHOW WARNINGS; |
| 17 |
source show_varpart.inc; |
| 18 |
|
| 19 |
# Turn off strict mode since INSERT intentionally truncate data |
| 20 |
--source suite/ndb/include/turn_off_strict_sql_mode.inc |
| 21 |
INSERT INTO t1 values(0,''),(2,"**"),(4,"****"),(6,"******"),(8,"********"),(10,"**********"),(12,"************"); |
| 22 |
--source suite/ndb/include/restore_sql_mode_after_turn_off_strict.inc |
| 23 |
SELECT * FROM t1 ORDER BY a; |
| 24 |
DROP TABLE t1; |
| 25 |
|
| 26 |
# |
| 27 |
# Check force var part for different ROW_FORMAT |
| 28 |
# |
| 29 |
|
| 30 |
# default => ForceVarPart: 1 |
| 31 |
CREATE TABLE t1 ( |
| 32 |
a INT KEY, |
| 33 |
b INT |
| 34 |
) |
| 35 |
ENGINE=NDB; |
| 36 |
source show_varpart.inc; |
| 37 |
DROP TABLE t1; |
| 38 |
|
| 39 |
# explicit DEFAULT => ForceVarPart: 1 |
| 40 |
CREATE TABLE t1( |
| 41 |
a INT KEY, |
| 42 |
b INT |
| 43 |
) |
| 44 |
ROW_FORMAT=DEFAULT |
| 45 |
ENGINE=NDB; |
| 46 |
source show_varpart.inc; |
| 47 |
DROP TABLE t1; |
| 48 |
|
| 49 |
# FIXED => ForceVarPart: 0 |
| 50 |
CREATE TABLE t1( |
| 51 |
a INT KEY, |
| 52 |
b INT |
| 53 |
) |
| 54 |
ROW_FORMAT=FIXED |
| 55 |
ENGINE=NDB; |
| 56 |
source show_varpart.inc; |
| 57 |
DROP TABLE t1; |
| 58 |
|
| 59 |
# DYNAMIC => ForceVarPart: 1 |
| 60 |
CREATE TABLE t1( |
| 61 |
a INT KEY, |
| 62 |
b INT |
| 63 |
) |
| 64 |
ROW_FORMAT=DYNAMIC |
| 65 |
ENGINE=NDB; |
| 66 |
source show_varpart.inc; |
| 67 |
DROP TABLE t1; |
| 68 |
|
| 69 |
# test of bug |
| 70 |
create table t1 ( |
| 71 |
a int auto_increment primary key, |
| 72 |
b varchar(1000) character set latin1 |
| 73 |
) engine = ndb; |
| 74 |
insert into t1(b) values ('0123456789'); |
| 75 |
insert into t1(b) select b from t1; |
| 76 |
insert into t1(b) select b from t1; |
| 77 |
insert into t1(b) select b from t1; |
| 78 |
insert into t1(b) select b from t1; |
| 79 |
insert into t1(b) select b from t1; |
| 80 |
insert into t1(b) select b from t1; |
| 81 |
insert into t1(b) select b from t1; |
| 82 |
insert into t1(b) select b from t1; |
| 83 |
insert into t1(b) select b from t1; |
| 84 |
insert into t1(b) select b from t1; |
| 85 |
select count(*) from t1; |
| 86 |
begin; |
| 87 |
update t1 set b = concat(b,b); |
| 88 |
update t1 set b = concat(b,b); |
| 89 |
update t1 set b = concat(b,b); |
| 90 |
update t1 set b = concat(b,b); |
| 91 |
update t1 set b = concat(b,b); |
| 92 |
rollback; |
| 93 |
select count(*),b from t1 group by b; |
| 94 |
drop table t1; |
| 95 |
|
| 96 |
# |
| 97 |
# Bug#27230898 Check create table with different row_format options |
| 98 |
# |
| 99 |
|
| 100 |
CREATE TABLE t1(a int primary key,b int) ROW_FORMAT=DEFAULT engine = NDB; |
| 101 |
|
| 102 |
CREATE TABLE t2(a int primary key,b int) ROW_FORMAT=DYNAMIC engine = NDB; |
| 103 |
|
| 104 |
CREATE TABLE t3(a int primary key,b int) ROW_FORMAT=FIXED engine = NDB; |
| 105 |
|
| 106 |
--error ER_ILLEGAL_HA_CREATE_OPTION |
| 107 |
CREATE TABLE t4(a int primary key,b int) ROW_FORMAT=COMPRESSED engine = NDB; |
| 108 |
|
| 109 |
--error ER_ILLEGAL_HA_CREATE_OPTION |
| 110 |
CREATE TABLE t5(a int primary key,b int) ROW_FORMAT=REDUNDANT engine = NDB; |
| 111 |
|
| 112 |
--error ER_ILLEGAL_HA_CREATE_OPTION |
| 113 |
CREATE TABLE t6(a int primary key,b int) ROW_FORMAT=COMPACT engine = NDB; |
| 114 |
|
| 115 |
SELECT table_name, row_format FROM information_schema.tables |
| 116 |
WHERE TABLE_SCHEMA = 'test' order by TABLE_NAME; |
| 117 |
|
| 118 |
# Check that atler table with unsupported row_format options fails |
| 119 |
--error ER_ILLEGAL_HA_CREATE_OPTION |
| 120 |
ALTER TABLE t2 ALGORITHM=COPY,ROW_FORMAT=COMPRESSED; |
| 121 |
|
| 122 |
# Clean up. |
| 123 |
DROP TABLE t1,t2,t3; |