|
| 1 | +SET NAMES utf8mb4; |
| 2 | +# |
| 3 | +# MDEV-11233 CREATE FULLTEXT INDEX with a token |
| 4 | +# longer than 127 bytes crashes server |
| 5 | +# |
| 6 | +CREATE TABLE t(t TEXT CHARACTER SET utf8mb3) ENGINE=InnoDB; |
| 7 | +INSERT INTO t SET t=REPEAT(CONCAT(REPEAT(_utf8mb3 0xE0B987, 4), REPEAT(_utf8mb3 0xE0B989, 5)), 5); |
| 8 | +INSERT INTO t SET t=REPEAT(_utf8 0xefbc90,84); |
| 9 | +INSERT INTO t SET t=REPEAT('befor',17); |
| 10 | +INSERT INTO t SET t='BeforeTheIndexCreation'; |
| 11 | +CREATE FULLTEXT INDEX ft ON t(t); |
| 12 | +Warnings: |
| 13 | +Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID |
| 14 | +INSERT INTO t SET t='this was inserted after creating the index'; |
| 15 | +INSERT INTO t SET t=REPEAT(_utf8 0xefbc91,84); |
| 16 | +INSERT INTO t SET t=REPEAT('after',17); |
| 17 | +INSERT INTO t SET t=REPEAT(_utf8mb3 0xe794b2e9aaa8e69687, 15); |
| 18 | +# The data below is not 3-byte UTF-8, but 4-byte chars. |
| 19 | +INSERT INTO t SET t=REPEAT(_utf8mb4 0xf09f9695, 84); |
| 20 | +Warnings: |
| 21 | +Warning 1366 Incorrect string value: '\xF0\x9F\x96\x95\xF0\x9F...' for column 't' at row 1 |
| 22 | +INSERT INTO t SET t=REPEAT(_utf8mb4 0xf09f9696, 85); |
| 23 | +Warnings: |
| 24 | +Warning 1366 Incorrect string value: '\xF0\x9F\x96\x96\xF0\x9F...' for column 't' at row 1 |
| 25 | +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST |
| 26 | +(REPEAT(CONCAT(REPEAT(_utf8mb3 0xE0B987, 4), REPEAT(_utf8mb3 0xE0B989, 5)), 5)); |
| 27 | +COUNT(*) |
| 28 | +1 |
| 29 | +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST ('BeforeTheIndexCreation'); |
| 30 | +COUNT(*) |
| 31 | +1 |
| 32 | +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT('befor',17)); |
| 33 | +COUNT(*) |
| 34 | +0 |
| 35 | +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST ('after'); |
| 36 | +COUNT(*) |
| 37 | +1 |
| 38 | +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT('after',17)); |
| 39 | +COUNT(*) |
| 40 | +0 |
| 41 | +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 83)); |
| 42 | +COUNT(*) |
| 43 | +0 |
| 44 | +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 84)); |
| 45 | +COUNT(*) |
| 46 | +1 |
| 47 | +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 85)); |
| 48 | +COUNT(*) |
| 49 | +0 |
| 50 | +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 83)); |
| 51 | +COUNT(*) |
| 52 | +0 |
| 53 | +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 84)); |
| 54 | +COUNT(*) |
| 55 | +1 |
| 56 | +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 85)); |
| 57 | +COUNT(*) |
| 58 | +0 |
| 59 | +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9695, 83)); |
| 60 | +COUNT(*) |
| 61 | +0 |
| 62 | +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9695, 84)); |
| 63 | +COUNT(*) |
| 64 | +0 |
| 65 | +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9696, 84)); |
| 66 | +COUNT(*) |
| 67 | +0 |
| 68 | +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9696, 85)); |
| 69 | +COUNT(*) |
| 70 | +0 |
| 71 | +SELECT * FROM t; |
| 72 | +t |
| 73 | +็็็็้้้้้็็็็้้้้้็็็็้้้้้็็็็้้้้้็็็็้้้้้ |
| 74 | +000000000000000000000000000000000000000000000000000000000000000000000000000000000000 |
| 75 | +beforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbefor |
| 76 | +BeforeTheIndexCreation |
| 77 | +this was inserted after creating the index |
| 78 | +111111111111111111111111111111111111111111111111111111111111111111111111111111111111 |
| 79 | +afterafterafterafterafterafterafterafterafterafterafterafterafterafterafterafterafter |
| 80 | +甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文 |
| 81 | +???????????????????????????????????????????????????????????????????????????????????? |
| 82 | +????????????????????????????????????????????????????????????????????????????????????? |
| 83 | +SELECT len,COUNT(*) FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS where name='word' GROUP BY len; |
| 84 | +len COUNT(*) |
| 85 | +252 6 |
| 86 | +DROP TABLE t; |
| 87 | +CREATE TABLE t(t TEXT CHARACTER SET utf8mb4) ENGINE=InnoDB; |
| 88 | +INSERT INTO t SET t=REPEAT(_utf8mb3 0xe794b2e9aaa8e69687, 15); |
| 89 | +INSERT INTO t SET t=REPEAT(_utf8 0xefbc90,84); |
| 90 | +INSERT INTO t SET t=REPEAT('befor',17); |
| 91 | +INSERT INTO t SET t='BeforeTheIndexCreation'; |
| 92 | +CREATE FULLTEXT INDEX ft ON t(t); |
| 93 | +Warnings: |
| 94 | +Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID |
| 95 | +INSERT INTO t SET t='this was inserted after creating the index'; |
| 96 | +INSERT INTO t SET t=REPEAT(_utf8 0xefbc91,84); |
| 97 | +INSERT INTO t SET t=REPEAT('after',17); |
| 98 | +INSERT INTO t SET t=REPEAT(concat(repeat(_utf8mb3 0xE0B987, 4), repeat(_utf8mb3 0xE0B989, 5)), 5); |
| 99 | +INSERT INTO t SET t=REPEAT(_utf8mb4 0xf09f9695, 84); |
| 100 | +# The token below exceeds the 84-character limit. |
| 101 | +INSERT INTO t SET t=REPEAT(_utf8mb4 0xf09f9696, 85); |
| 102 | +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb3 0xe794b2e9aaa8e69687, 15)); |
| 103 | +COUNT(*) |
| 104 | +1 |
| 105 | +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST ('BeforeTheIndexCreation'); |
| 106 | +COUNT(*) |
| 107 | +1 |
| 108 | +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT('befor',17)); |
| 109 | +COUNT(*) |
| 110 | +0 |
| 111 | +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST ('after'); |
| 112 | +COUNT(*) |
| 113 | +1 |
| 114 | +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT('after',17)); |
| 115 | +COUNT(*) |
| 116 | +0 |
| 117 | +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 83)); |
| 118 | +COUNT(*) |
| 119 | +0 |
| 120 | +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 84)); |
| 121 | +COUNT(*) |
| 122 | +1 |
| 123 | +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 85)); |
| 124 | +COUNT(*) |
| 125 | +0 |
| 126 | +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 83)); |
| 127 | +COUNT(*) |
| 128 | +0 |
| 129 | +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 84)); |
| 130 | +COUNT(*) |
| 131 | +1 |
| 132 | +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 85)); |
| 133 | +COUNT(*) |
| 134 | +0 |
| 135 | +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9695, 83)); |
| 136 | +COUNT(*) |
| 137 | +0 |
| 138 | +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9695, 84)); |
| 139 | +COUNT(*) |
| 140 | +0 |
| 141 | +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9696, 84)); |
| 142 | +COUNT(*) |
| 143 | +0 |
| 144 | +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9696, 85)); |
| 145 | +COUNT(*) |
| 146 | +0 |
| 147 | +SELECT * FROM t; |
| 148 | +t |
| 149 | +甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文 |
| 150 | +000000000000000000000000000000000000000000000000000000000000000000000000000000000000 |
| 151 | +beforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbefor |
| 152 | +BeforeTheIndexCreation |
| 153 | +this was inserted after creating the index |
| 154 | +111111111111111111111111111111111111111111111111111111111111111111111111111111111111 |
| 155 | +afterafterafterafterafterafterafterafterafterafterafterafterafterafterafterafterafter |
| 156 | +็็็็้้้้้็็็็้้้้้็็็็้้้้้็็็็้้้้้็็็็้้้้้ |
| 157 | +🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕 |
| 158 | +🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖 |
| 159 | +SELECT len,COUNT(*) FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS where name='word' GROUP BY len; |
| 160 | +len COUNT(*) |
| 161 | +336 6 |
| 162 | +DROP TABLE t; |
| 163 | +CREATE TABLE t(t TEXT CHARACTER SET latin1, FULLTEXT INDEX(t)) |
| 164 | +ENGINE=InnoDB; |
| 165 | +SELECT len,COUNT(*) FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS where name='word' GROUP BY len; |
| 166 | +len COUNT(*) |
| 167 | +84 6 |
| 168 | +DROP TABLE t; |
0 commit comments