1--source include/have_rocksdb.inc
2
3#
4# VARCHAR column types
5#
6
7--echo #
8--echo # A basic test whether endspace-aware variable length encoding
9--echo # works when in PK
10--echo #
11create table t1 ( pk varchar(10) primary key, col1 int not null) engine=rocksdb;
12insert into t1 values ('a', 1);
13select * from t1;
14drop table t1;
15
16--let $extra_col_opts_ddl_err = 0
17--let $extra_col_opts_dml_err = 0
18--source suite/rocksdb/include/type_varchar.inc
19
20
21--echo #
22--echo # Endspace-comparison tests:
23--echo #
24
25--let $character_set_collate=CHARACTER SET latin1 COLLATE latin1_bin
26--source suite/rocksdb/include/type_varchar_endspace.inc
27
28--let $character_set_collate=CHARACTER SET utf8 COLLATE utf8_bin
29--source suite/rocksdb/include/type_varchar_endspace.inc
30
31--let $character_set_collate=CHARACTER SET ucs2 COLLATE ucs2_bin
32--source suite/rocksdb/include/type_varchar_endspace.inc
33
34--let $character_set_collate=CHARACTER SET utf8mb4 COLLATE utf8mb4_bin
35--source suite/rocksdb/include/type_varchar_endspace.inc
36
37--let $character_set_collate=CHARACTER SET utf16 COLLATE utf16_bin
38--source suite/rocksdb/include/type_varchar_endspace.inc
39
40create table t1 (
41  pk int primary key,
42  col1 varchar(10) collate utf8mb4_bin not null,
43  col2 varchar(20),
44  key(col1)
45) engine=rocksdb;
46
47insert into t1 values (1, 'ab','ab');
48insert into t1 values (2, 'ab\0','ab0');
49
50select pk, hex(col1), col2 from t1 force index(col1) order by col1;
51select pk, hex(col1), col2 from t1 ignore index(col1) order by col1;
52drop table t1;
53
54# Issue #306 - Do not store trailing spaces for prefixed keys.
55create table t (id int primary key, email varchar(100), KEY email_i (email(30))) engine=rocksdb;
56insert into t values (1, 'abcabcabcabcabcabcabcabcabcabcabc  ');
57--replace_column 10 # 11 #
58explain select 'email_i' as index_name, count(*) AS count from t force index(email_i);
59select 'email_i' as index_name, count(*) AS count from t force index(email_i);
60drop table t;
61
62set @save_rocksdb_checksums_pct = @@global.rocksdb_checksums_pct;
63set @save_rocksdb_verify_row_debug_checksums = @@session.rocksdb_verify_row_debug_checksums;
64set global rocksdb_checksums_pct = 100;
65set session rocksdb_verify_row_debug_checksums = on;
66create table t (id int primary key, email varchar(100), KEY email_i (email(30))) engine=rocksdb;
67insert into t values (1, 'a');
68--replace_column 10 # 11 #
69explain select 'email_i' as index_name, count(*) AS count from t force index(email_i);
70select 'email_i' as index_name, count(*) AS count from t force index(email_i);
71drop table t;
72set global rocksdb_checksums_pct = @save_rocksdb_checksums_pct;
73set session rocksdb_verify_row_debug_checksums = @save_rocksdb_verify_row_debug_checksums;
74
75# Issue #784 - Skip trailing space bytes for non-unpackable fields
76
77create table t (h varchar(31) character set utf8 collate utf8_bin not null, i varchar(19) collate latin1_bin not null, primary key(i), key(h)) engine=rocksdb;
78insert into t(i,h) values('a','b');
79check table t;
80alter table t modify h varchar(31) character set cp1257 collate cp1257_bin not null;
81check table t;
82drop table t;
83