Commit 6f829a4f authored by unknown's avatar unknown

Merge gbichot@bk-internal.mysql.com:/home/bk/mysql-maria

into  gbichot4.local:/home/mysql_src/mysql-maria-monty

parents 86b7194c c9a82581
set storage_engine=maria;
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (
fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
g GEOMETRY NOT NULL,
SPATIAL KEY(g)
) row_format=dynamic;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`fid` int(11) NOT NULL AUTO_INCREMENT,
`g` geometry NOT NULL,
PRIMARY KEY (`fid`),
SPATIAL KEY `g` (`g`)
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 ROW_FORMAT=DYNAMIC
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(150 150, 150 150)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(149 149, 151 151)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(148 148, 152 152)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(147 147, 153 153)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(146 146, 154 154)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(145 145, 155 155)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(144 144, 156 156)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(143 143, 157 157)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(142 142, 158 158)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(141 141, 159 159)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(140 140, 160 160)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(139 139, 161 161)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(138 138, 162 162)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(137 137, 163 163)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(136 136, 164 164)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(135 135, 165 165)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(134 134, 166 166)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(133 133, 167 167)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(132 132, 168 168)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(131 131, 169 169)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(130 130, 170 170)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(129 129, 171 171)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(128 128, 172 172)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(127 127, 173 173)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(126 126, 174 174)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(125 125, 175 175)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(124 124, 176 176)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(123 123, 177 177)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(122 122, 178 178)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(121 121, 179 179)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(120 120, 180 180)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(119 119, 181 181)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(118 118, 182 182)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(117 117, 183 183)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(116 116, 184 184)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(115 115, 185 185)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(114 114, 186 186)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(113 113, 187 187)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(112 112, 188 188)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(111 111, 189 189)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(110 110, 190 190)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(109 109, 191 191)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(108 108, 192 192)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(107 107, 193 193)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(106 106, 194 194)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(105 105, 195 195)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(104 104, 196 196)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(103 103, 197 197)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(102 102, 198 198)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(101 101, 199 199)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(100 100, 200 200)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(99 99, 201 201)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(98 98, 202 202)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(97 97, 203 203)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(96 96, 204 204)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(95 95, 205 205)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(94 94, 206 206)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(93 93, 207 207)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(92 92, 208 208)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(91 91, 209 209)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(90 90, 210 210)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(89 89, 211 211)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(88 88, 212 212)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(87 87, 213 213)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(86 86, 214 214)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(85 85, 215 215)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(84 84, 216 216)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(83 83, 217 217)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(82 82, 218 218)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(81 81, 219 219)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(80 80, 220 220)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(79 79, 221 221)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(78 78, 222 222)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(77 77, 223 223)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(76 76, 224 224)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(75 75, 225 225)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(74 74, 226 226)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(73 73, 227 227)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(72 72, 228 228)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(71 71, 229 229)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(70 70, 230 230)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(69 69, 231 231)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(68 68, 232 232)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(67 67, 233 233)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(66 66, 234 234)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(65 65, 235 235)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(64 64, 236 236)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(63 63, 237 237)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(62 62, 238 238)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(61 61, 239 239)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(60 60, 240 240)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(59 59, 241 241)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(58 58, 242 242)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(57 57, 243 243)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(56 56, 244 244)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(55 55, 245 245)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(54 54, 246 246)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(53 53, 247 247)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(52 52, 248 248)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(51 51, 249 249)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(50 50, 250 250)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(49 49, 251 251)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(48 48, 252 252)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(47 47, 253 253)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(46 46, 254 254)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(45 45, 255 255)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(44 44, 256 256)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(43 43, 257 257)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(42 42, 258 258)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(41 41, 259 259)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(40 40, 260 260)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(39 39, 261 261)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(38 38, 262 262)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(37 37, 263 263)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(36 36, 264 264)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(35 35, 265 265)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(34 34, 266 266)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(33 33, 267 267)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(32 32, 268 268)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(31 31, 269 269)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(30 30, 270 270)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(29 29, 271 271)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(28 28, 272 272)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(27 27, 273 273)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(26 26, 274 274)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(25 25, 275 275)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(24 24, 276 276)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(23 23, 277 277)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(22 22, 278 278)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(21 21, 279 279)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(20 20, 280 280)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(19 19, 281 281)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(18 18, 282 282)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(17 17, 283 283)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(16 16, 284 284)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(15 15, 285 285)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(14 14, 286 286)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(13 13, 287 287)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(12 12, 288 288)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(11 11, 289 289)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(10 10, 290 290)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(9 9, 291 291)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(8 8, 292 292)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(7 7, 293 293)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(6 6, 294 294)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(5 5, 295 295)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(4 4, 296 296)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(3 3, 297 297)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(2 2, 298 298)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(1 1, 299 299)'));
SELECT count(*) FROM t1;
count(*)
150
EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range g g 34 NULL 11 Using where
SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
fid AsText(g)
1 LINESTRING(150 150,150 150)
2 LINESTRING(149 149,151 151)
3 LINESTRING(148 148,152 152)
4 LINESTRING(147 147,153 153)
5 LINESTRING(146 146,154 154)
6 LINESTRING(145 145,155 155)
7 LINESTRING(144 144,156 156)
8 LINESTRING(143 143,157 157)
9 LINESTRING(142 142,158 158)
10 LINESTRING(141 141,159 159)
11 LINESTRING(140 140,160 160)
DROP TABLE t1;
CREATE TABLE t2 (
fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
g GEOMETRY NOT NULL
) row_format=dynamic;
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 9 * 10 - 9), Point(10 * 10, 9 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 8 * 10 - 9), Point(10 * 10, 8 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 7 * 10 - 9), Point(10 * 10, 7 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 6 * 10 - 9), Point(10 * 10, 6 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 5 * 10 - 9), Point(10 * 10, 5 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 4 * 10 - 9), Point(10 * 10, 4 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 3 * 10 - 9), Point(10 * 10, 3 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 2 * 10 - 9), Point(10 * 10, 2 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 1 * 10 - 9), Point(10 * 10, 1 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 10 * 10 - 9), Point(9 * 10, 10 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 9 * 10 - 9), Point(9 * 10, 9 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 8 * 10 - 9), Point(9 * 10, 8 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 7 * 10 - 9), Point(9 * 10, 7 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 6 * 10 - 9), Point(9 * 10, 6 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 5 * 10 - 9), Point(9 * 10, 5 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 4 * 10 - 9), Point(9 * 10, 4 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 3 * 10 - 9), Point(9 * 10, 3 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 2 * 10 - 9), Point(9 * 10, 2 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 1 * 10 - 9), Point(9 * 10, 1 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 10 * 10 - 9), Point(8 * 10, 10 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 9 * 10 - 9), Point(8 * 10, 9 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 8 * 10 - 9), Point(8 * 10, 8 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 7 * 10 - 9), Point(8 * 10, 7 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 6 * 10 - 9), Point(8 * 10, 6 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 5 * 10 - 9), Point(8 * 10, 5 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 4 * 10 - 9), Point(8 * 10, 4 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 3 * 10 - 9), Point(8 * 10, 3 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 2 * 10 - 9), Point(8 * 10, 2 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 1 * 10 - 9), Point(8 * 10, 1 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 10 * 10 - 9), Point(7 * 10, 10 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 9 * 10 - 9), Point(7 * 10, 9 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 8 * 10 - 9), Point(7 * 10, 8 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 7 * 10 - 9), Point(7 * 10, 7 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 6 * 10 - 9), Point(7 * 10, 6 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 5 * 10 - 9), Point(7 * 10, 5 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 4 * 10 - 9), Point(7 * 10, 4 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 3 * 10 - 9), Point(7 * 10, 3 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 2 * 10 - 9), Point(7 * 10, 2 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 1 * 10 - 9), Point(7 * 10, 1 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 10 * 10 - 9), Point(6 * 10, 10 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 9 * 10 - 9), Point(6 * 10, 9 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 8 * 10 - 9), Point(6 * 10, 8 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 7 * 10 - 9), Point(6 * 10, 7 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 6 * 10 - 9), Point(6 * 10, 6 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 5 * 10 - 9), Point(6 * 10, 5 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 4 * 10 - 9), Point(6 * 10, 4 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 3 * 10 - 9), Point(6 * 10, 3 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 2 * 10 - 9), Point(6 * 10, 2 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 1 * 10 - 9), Point(6 * 10, 1 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 10 * 10 - 9), Point(5 * 10, 10 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 9 * 10 - 9), Point(5 * 10, 9 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 8 * 10 - 9), Point(5 * 10, 8 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 7 * 10 - 9), Point(5 * 10, 7 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 6 * 10 - 9), Point(5 * 10, 6 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 5 * 10 - 9), Point(5 * 10, 5 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 4 * 10 - 9), Point(5 * 10, 4 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 3 * 10 - 9), Point(5 * 10, 3 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 2 * 10 - 9), Point(5 * 10, 2 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 1 * 10 - 9), Point(5 * 10, 1 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 10 * 10 - 9), Point(4 * 10, 10 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 9 * 10 - 9), Point(4 * 10, 9 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 8 * 10 - 9), Point(4 * 10, 8 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 7 * 10 - 9), Point(4 * 10, 7 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 6 * 10 - 9), Point(4 * 10, 6 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 5 * 10 - 9), Point(4 * 10, 5 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 4 * 10 - 9), Point(4 * 10, 4 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 3 * 10 - 9), Point(4 * 10, 3 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 2 * 10 - 9), Point(4 * 10, 2 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 1 * 10 - 9), Point(4 * 10, 1 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 10 * 10 - 9), Point(3 * 10, 10 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 9 * 10 - 9), Point(3 * 10, 9 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 8 * 10 - 9), Point(3 * 10, 8 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 7 * 10 - 9), Point(3 * 10, 7 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 6 * 10 - 9), Point(3 * 10, 6 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 5 * 10 - 9), Point(3 * 10, 5 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 4 * 10 - 9), Point(3 * 10, 4 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 3 * 10 - 9), Point(3 * 10, 3 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 2 * 10 - 9), Point(3 * 10, 2 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 1 * 10 - 9), Point(3 * 10, 1 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 10 * 10 - 9), Point(2 * 10, 10 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 9 * 10 - 9), Point(2 * 10, 9 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 8 * 10 - 9), Point(2 * 10, 8 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 7 * 10 - 9), Point(2 * 10, 7 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 6 * 10 - 9), Point(2 * 10, 6 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 5 * 10 - 9), Point(2 * 10, 5 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 4 * 10 - 9), Point(2 * 10, 4 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 3 * 10 - 9), Point(2 * 10, 3 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 2 * 10 - 9), Point(2 * 10, 2 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 1 * 10 - 9), Point(2 * 10, 1 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 10 * 10 - 9), Point(1 * 10, 10 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 9 * 10 - 9), Point(1 * 10, 9 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 8 * 10 - 9), Point(1 * 10, 8 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 7 * 10 - 9), Point(1 * 10, 7 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 6 * 10 - 9), Point(1 * 10, 6 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 5 * 10 - 9), Point(1 * 10, 5 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 4 * 10 - 9), Point(1 * 10, 4 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 3 * 10 - 9), Point(1 * 10, 3 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 2 * 10 - 9), Point(1 * 10, 2 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 1 * 10 - 9), Point(1 * 10, 1 * 10))));
ALTER TABLE t2 ADD SPATIAL KEY(g);
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`fid` int(11) NOT NULL AUTO_INCREMENT,
`g` geometry NOT NULL,
PRIMARY KEY (`fid`),
SPATIAL KEY `g` (`g`)
) ENGINE=MARIA AUTO_INCREMENT=101 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 ROW_FORMAT=DYNAMIC
SELECT count(*) FROM t2;
count(*)
100
EXPLAIN SELECT fid, AsText(g) FROM t2 WHERE Within(g,
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range g g 34 NULL 4 Using where
SELECT fid, AsText(g) FROM t2 WHERE Within(g,
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
fid AsText(g)
45 LINESTRING(51 51,60 60)
46 LINESTRING(51 41,60 50)
55 LINESTRING(41 51,50 60)
56 LINESTRING(41 41,50 50)
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10)))));
SELECT count(*) FROM t2;
count(*)
99
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 9 * 10 - 9), Point(10 * 10, 9 * 10)))));
SELECT count(*) FROM t2;
count(*)
98
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 8 * 10 - 9), Point(10 * 10, 8 * 10)))));
SELECT count(*) FROM t2;
count(*)
97
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 7 * 10 - 9), Point(10 * 10, 7 * 10)))));
SELECT count(*) FROM t2;
count(*)
96
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 6 * 10 - 9), Point(10 * 10, 6 * 10)))));
SELECT count(*) FROM t2;
count(*)
95
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 5 * 10 - 9), Point(10 * 10, 5 * 10)))));
SELECT count(*) FROM t2;
count(*)
94
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 4 * 10 - 9), Point(10 * 10, 4 * 10)))));
SELECT count(*) FROM t2;
count(*)
93
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 3 * 10 - 9), Point(10 * 10, 3 * 10)))));
SELECT count(*) FROM t2;
count(*)
92
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 2 * 10 - 9), Point(10 * 10, 2 * 10)))));
SELECT count(*) FROM t2;
count(*)
91
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 1 * 10 - 9), Point(10 * 10, 1 * 10)))));
SELECT count(*) FROM t2;
count(*)
90
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 10 * 10 - 9), Point(9 * 10, 10 * 10)))));
SELECT count(*) FROM t2;
count(*)
89
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 9 * 10 - 9), Point(9 * 10, 9 * 10)))));
SELECT count(*) FROM t2;
count(*)
88
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 8 * 10 - 9), Point(9 * 10, 8 * 10)))));
SELECT count(*) FROM t2;
count(*)
87
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 7 * 10 - 9), Point(9 * 10, 7 * 10)))));
SELECT count(*) FROM t2;
count(*)
86
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 6 * 10 - 9), Point(9 * 10, 6 * 10)))));
SELECT count(*) FROM t2;
count(*)
85
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 5 * 10 - 9), Point(9 * 10, 5 * 10)))));
SELECT count(*) FROM t2;
count(*)
84
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 4 * 10 - 9), Point(9 * 10, 4 * 10)))));
SELECT count(*) FROM t2;
count(*)
83
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 3 * 10 - 9), Point(9 * 10, 3 * 10)))));
SELECT count(*) FROM t2;
count(*)
82
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 2 * 10 - 9), Point(9 * 10, 2 * 10)))));
SELECT count(*) FROM t2;
count(*)
81
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 1 * 10 - 9), Point(9 * 10, 1 * 10)))));
SELECT count(*) FROM t2;
count(*)
80
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 10 * 10 - 9), Point(8 * 10, 10 * 10)))));
SELECT count(*) FROM t2;
count(*)
79
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 9 * 10 - 9), Point(8 * 10, 9 * 10)))));
SELECT count(*) FROM t2;
count(*)
78
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 8 * 10 - 9), Point(8 * 10, 8 * 10)))));
SELECT count(*) FROM t2;
count(*)
77
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 7 * 10 - 9), Point(8 * 10, 7 * 10)))));
SELECT count(*) FROM t2;
count(*)
76
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 6 * 10 - 9), Point(8 * 10, 6 * 10)))));
SELECT count(*) FROM t2;
count(*)
75
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 5 * 10 - 9), Point(8 * 10, 5 * 10)))));
SELECT count(*) FROM t2;
count(*)
74
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 4 * 10 - 9), Point(8 * 10, 4 * 10)))));
SELECT count(*) FROM t2;
count(*)
73
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 3 * 10 - 9), Point(8 * 10, 3 * 10)))));
SELECT count(*) FROM t2;
count(*)
72
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 2 * 10 - 9), Point(8 * 10, 2 * 10)))));
SELECT count(*) FROM t2;
count(*)
71
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 1 * 10 - 9), Point(8 * 10, 1 * 10)))));
SELECT count(*) FROM t2;
count(*)
70
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 10 * 10 - 9), Point(7 * 10, 10 * 10)))));
SELECT count(*) FROM t2;
count(*)
69
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 9 * 10 - 9), Point(7 * 10, 9 * 10)))));
SELECT count(*) FROM t2;
count(*)
68
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 8 * 10 - 9), Point(7 * 10, 8 * 10)))));
SELECT count(*) FROM t2;
count(*)
67
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 7 * 10 - 9), Point(7 * 10, 7 * 10)))));
SELECT count(*) FROM t2;
count(*)
66
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 6 * 10 - 9), Point(7 * 10, 6 * 10)))));
SELECT count(*) FROM t2;
count(*)
65
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 5 * 10 - 9), Point(7 * 10, 5 * 10)))));
SELECT count(*) FROM t2;
count(*)
64
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 4 * 10 - 9), Point(7 * 10, 4 * 10)))));
SELECT count(*) FROM t2;
count(*)
63
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 3 * 10 - 9), Point(7 * 10, 3 * 10)))));
SELECT count(*) FROM t2;
count(*)
62
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 2 * 10 - 9), Point(7 * 10, 2 * 10)))));
SELECT count(*) FROM t2;
count(*)
61
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 1 * 10 - 9), Point(7 * 10, 1 * 10)))));
SELECT count(*) FROM t2;
count(*)
60
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 10 * 10 - 9), Point(6 * 10, 10 * 10)))));
SELECT count(*) FROM t2;
count(*)
59
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 9 * 10 - 9), Point(6 * 10, 9 * 10)))));
SELECT count(*) FROM t2;
count(*)
58
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 8 * 10 - 9), Point(6 * 10, 8 * 10)))));
SELECT count(*) FROM t2;
count(*)
57
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 7 * 10 - 9), Point(6 * 10, 7 * 10)))));
SELECT count(*) FROM t2;
count(*)
56
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 6 * 10 - 9), Point(6 * 10, 6 * 10)))));
SELECT count(*) FROM t2;
count(*)
55
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 5 * 10 - 9), Point(6 * 10, 5 * 10)))));
SELECT count(*) FROM t2;
count(*)
54
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 4 * 10 - 9), Point(6 * 10, 4 * 10)))));
SELECT count(*) FROM t2;
count(*)
53
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 3 * 10 - 9), Point(6 * 10, 3 * 10)))));
SELECT count(*) FROM t2;
count(*)
52
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 2 * 10 - 9), Point(6 * 10, 2 * 10)))));
SELECT count(*) FROM t2;
count(*)
51
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 1 * 10 - 9), Point(6 * 10, 1 * 10)))));
SELECT count(*) FROM t2;
count(*)
50
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 10 * 10 - 9), Point(5 * 10, 10 * 10)))));
SELECT count(*) FROM t2;
count(*)
49
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 9 * 10 - 9), Point(5 * 10, 9 * 10)))));
SELECT count(*) FROM t2;
count(*)
48
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 8 * 10 - 9), Point(5 * 10, 8 * 10)))));
SELECT count(*) FROM t2;
count(*)
47
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 7 * 10 - 9), Point(5 * 10, 7 * 10)))));
SELECT count(*) FROM t2;
count(*)
46
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 6 * 10 - 9), Point(5 * 10, 6 * 10)))));
SELECT count(*) FROM t2;
count(*)
45
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 5 * 10 - 9), Point(5 * 10, 5 * 10)))));
SELECT count(*) FROM t2;
count(*)
44
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 4 * 10 - 9), Point(5 * 10, 4 * 10)))));
SELECT count(*) FROM t2;
count(*)
43
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 3 * 10 - 9), Point(5 * 10, 3 * 10)))));
SELECT count(*) FROM t2;
count(*)
42
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 2 * 10 - 9), Point(5 * 10, 2 * 10)))));
SELECT count(*) FROM t2;
count(*)
41
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 1 * 10 - 9), Point(5 * 10, 1 * 10)))));
SELECT count(*) FROM t2;
count(*)
40
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 10 * 10 - 9), Point(4 * 10, 10 * 10)))));
SELECT count(*) FROM t2;
count(*)
39
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 9 * 10 - 9), Point(4 * 10, 9 * 10)))));
SELECT count(*) FROM t2;
count(*)
38
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 8 * 10 - 9), Point(4 * 10, 8 * 10)))));
SELECT count(*) FROM t2;
count(*)
37
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 7 * 10 - 9), Point(4 * 10, 7 * 10)))));
SELECT count(*) FROM t2;
count(*)
36
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 6 * 10 - 9), Point(4 * 10, 6 * 10)))));
SELECT count(*) FROM t2;
count(*)
35
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 5 * 10 - 9), Point(4 * 10, 5 * 10)))));
SELECT count(*) FROM t2;
count(*)
34
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 4 * 10 - 9), Point(4 * 10, 4 * 10)))));
SELECT count(*) FROM t2;
count(*)
33
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 3 * 10 - 9), Point(4 * 10, 3 * 10)))));
SELECT count(*) FROM t2;
count(*)
32
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 2 * 10 - 9), Point(4 * 10, 2 * 10)))));
SELECT count(*) FROM t2;
count(*)
31
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 1 * 10 - 9), Point(4 * 10, 1 * 10)))));
SELECT count(*) FROM t2;
count(*)
30
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 10 * 10 - 9), Point(3 * 10, 10 * 10)))));
SELECT count(*) FROM t2;
count(*)
29
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 9 * 10 - 9), Point(3 * 10, 9 * 10)))));
SELECT count(*) FROM t2;
count(*)
28
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 8 * 10 - 9), Point(3 * 10, 8 * 10)))));
SELECT count(*) FROM t2;
count(*)
27
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 7 * 10 - 9), Point(3 * 10, 7 * 10)))));
SELECT count(*) FROM t2;
count(*)
26
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 6 * 10 - 9), Point(3 * 10, 6 * 10)))));
SELECT count(*) FROM t2;
count(*)
25
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 5 * 10 - 9), Point(3 * 10, 5 * 10)))));
SELECT count(*) FROM t2;
count(*)
24
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 4 * 10 - 9), Point(3 * 10, 4 * 10)))));
SELECT count(*) FROM t2;
count(*)
23
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 3 * 10 - 9), Point(3 * 10, 3 * 10)))));
SELECT count(*) FROM t2;
count(*)
22
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 2 * 10 - 9), Point(3 * 10, 2 * 10)))));
SELECT count(*) FROM t2;
count(*)
21
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 1 * 10 - 9), Point(3 * 10, 1 * 10)))));
SELECT count(*) FROM t2;
count(*)
20
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 10 * 10 - 9), Point(2 * 10, 10 * 10)))));
SELECT count(*) FROM t2;
count(*)
19
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 9 * 10 - 9), Point(2 * 10, 9 * 10)))));
SELECT count(*) FROM t2;
count(*)
18
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 8 * 10 - 9), Point(2 * 10, 8 * 10)))));
SELECT count(*) FROM t2;
count(*)
17
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 7 * 10 - 9), Point(2 * 10, 7 * 10)))));
SELECT count(*) FROM t2;
count(*)
16
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 6 * 10 - 9), Point(2 * 10, 6 * 10)))));
SELECT count(*) FROM t2;
count(*)
15
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 5 * 10 - 9), Point(2 * 10, 5 * 10)))));
SELECT count(*) FROM t2;
count(*)
14
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 4 * 10 - 9), Point(2 * 10, 4 * 10)))));
SELECT count(*) FROM t2;
count(*)
13
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 3 * 10 - 9), Point(2 * 10, 3 * 10)))));
SELECT count(*) FROM t2;
count(*)
12
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 2 * 10 - 9), Point(2 * 10, 2 * 10)))));
SELECT count(*) FROM t2;
count(*)
11
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 1 * 10 - 9), Point(2 * 10, 1 * 10)))));
SELECT count(*) FROM t2;
count(*)
10
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 10 * 10 - 9), Point(1 * 10, 10 * 10)))));
SELECT count(*) FROM t2;
count(*)
9
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 9 * 10 - 9), Point(1 * 10, 9 * 10)))));
SELECT count(*) FROM t2;
count(*)
8
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 8 * 10 - 9), Point(1 * 10, 8 * 10)))));
SELECT count(*) FROM t2;
count(*)
7
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 7 * 10 - 9), Point(1 * 10, 7 * 10)))));
SELECT count(*) FROM t2;
count(*)
6
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 6 * 10 - 9), Point(1 * 10, 6 * 10)))));
SELECT count(*) FROM t2;
count(*)
5
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 5 * 10 - 9), Point(1 * 10, 5 * 10)))));
SELECT count(*) FROM t2;
count(*)
4
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 4 * 10 - 9), Point(1 * 10, 4 * 10)))));
SELECT count(*) FROM t2;
count(*)
3
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 3 * 10 - 9), Point(1 * 10, 3 * 10)))));
SELECT count(*) FROM t2;
count(*)
2
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 2 * 10 - 9), Point(1 * 10, 2 * 10)))));
SELECT count(*) FROM t2;
count(*)
1
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 1 * 10 - 9), Point(1 * 10, 1 * 10)))));
SELECT count(*) FROM t2;
count(*)
0
DROP TABLE t2;
drop table if exists t1;
Warnings:
Note 1051 Unknown table 't1'
CREATE TABLE t1 (a geometry NOT NULL, SPATIAL (a)) row_format=dynamic;
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
drop table t1;
CREATE TABLE t1 (
fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
g GEOMETRY NOT NULL,
SPATIAL KEY(g)
) row_format=dynamic;
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(1 2, 2 3)')),(GeomFromText('LineString(1 2, 2 4)'));
drop table t1;
CREATE TABLE t1 (
line LINESTRING NOT NULL,
kind ENUM('po', 'pp', 'rr', 'dr', 'rd', 'ts', 'cl') NOT NULL DEFAULT 'po',
name VARCHAR(32),
SPATIAL KEY (line)
) row_format=dynamic;
ALTER TABLE t1 DISABLE KEYS;
INSERT INTO t1 (name, kind, line) VALUES
("Aadaouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
("Aadassiye", "pp", GeomFromText("POINT(35.816667 36.216667)")),
("Aadbel", "pp", GeomFromText("POINT(34.533333 36.100000)")),
("Aadchit", "pp", GeomFromText("POINT(33.347222 35.423611)")),
("Aadchite", "pp", GeomFromText("POINT(33.347222 35.423611)")),
("Aadchit el Qoussair", "pp", GeomFromText("POINT(33.283333 35.483333)")),
("Aaddaye", "pp", GeomFromText("POINT(36.716667 40.833333)")),
("'Aadeissa", "pp", GeomFromText("POINT(32.823889 35.698889)")),
("Aaderup", "pp", GeomFromText("POINT(55.216667 11.766667)")),
("Qalaat Aades", "pp", GeomFromText("POINT(33.503333 35.377500)")),
("A ad'ino", "pp", GeomFromText("POINT(54.812222 38.209167)")),
("Aadi Noia", "pp", GeomFromText("POINT(13.800000 39.833333)")),
("Aad La Macta", "pp", GeomFromText("POINT(35.779444 -0.129167)")),
("Aadland", "pp", GeomFromText("POINT(60.366667 5.483333)")),
("Aadliye", "pp", GeomFromText("POINT(33.366667 36.333333)")),
("Aadloun", "pp", GeomFromText("POINT(33.403889 35.273889)")),
("Aadma", "pp", GeomFromText("POINT(58.798333 22.663889)")),
("Aadma Asundus", "pp", GeomFromText("POINT(58.798333 22.663889)")),
("Aadmoun", "pp", GeomFromText("POINT(34.150000 35.650000)")),
("Aadneram", "pp", GeomFromText("POINT(59.016667 6.933333)")),
("Aadneskaar", "pp", GeomFromText("POINT(58.083333 6.983333)")),
("Aadorf", "pp", GeomFromText("POINT(47.483333 8.900000)")),
("Aadorp", "pp", GeomFromText("POINT(52.366667 6.633333)")),
("Aadouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
("Aadoui", "pp", GeomFromText("POINT(34.450000 35.983333)")),
("Aadouiye", "pp", GeomFromText("POINT(34.583333 36.183333)")),
("Aadouss", "pp", GeomFromText("POINT(33.512500 35.601389)")),
("Aadra", "pp", GeomFromText("POINT(33.616667 36.500000)")),
("Aadzi", "pp", GeomFromText("POINT(38.100000 64.850000)"));
ALTER TABLE t1 ENABLE KEYS;
INSERT INTO t1 (name, kind, line) VALUES ("austria", "pp", GeomFromText('LINESTRING(14.9906 48.9887,14.9946 48.9904,14.9947 48.9916)'));
drop table t1;
CREATE TABLE t1 (st varchar(100));
INSERT INTO t1 VALUES ("Fake string");
CREATE TABLE t2 (geom GEOMETRY NOT NULL, SPATIAL KEY gk(geom)) row_format=dynamic;
INSERT INTO t2 SELECT GeomFromText(st) FROM t1;
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1, t2;
CREATE TABLE t1 (`geometry` geometry NOT NULL default '',SPATIAL KEY `gndx` (`geometry`)) row_format=dynamic DEFAULT CHARSET=latin1;
Warnings:
Warning 1101 BLOB/TEXT column 'geometry' can't have a default value
INSERT INTO t1 (geometry) VALUES
(PolygonFromText('POLYGON((-18.6086111000 -66.9327777000, -18.6055555000
-66.8158332999, -18.7186111000 -66.8102777000, -18.7211111000 -66.9269443999,
-18.6086111000 -66.9327777000))'));
INSERT INTO t1 (geometry) VALUES
(PolygonFromText('POLYGON((-65.7402776999 -96.6686111000, -65.7372222000
-96.5516666000, -65.8502777000 -96.5461111000, -65.8527777000 -96.6627777000,
-65.7402776999 -96.6686111000))'));
check table t1 extended;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
CREATE TABLE t1 (
c1 geometry NOT NULL default '',
SPATIAL KEY i1 (c1)
) row_format=dynamic DEFAULT CHARSET=latin1;
Warnings:
Warning 1101 BLOB/TEXT column 'c1' can't have a default value
INSERT INTO t1 (c1) VALUES (
PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
-18.6055555000 -66.8158332999,
-18.7186111000 -66.8102777000,
-18.7211111000 -66.9269443999,
-18.6086111000 -66.9327777000))'));
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
CREATE TABLE t1 (
c1 geometry NOT NULL default '',
SPATIAL KEY i1 (c1)
) row_format=dynamic DEFAULT CHARSET=latin1;
Warnings:
Warning 1101 BLOB/TEXT column 'c1' can't have a default value
INSERT INTO t1 (c1) VALUES (
PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
-18.6055555000 -66.8158332999,
-18.7186111000 -66.8102777000,
-18.7211111000 -66.9269443999,
-18.6086111000 -66.9327777000))'));
INSERT INTO t1 (c1) VALUES (
PolygonFromText('POLYGON((-65.7402776999 -96.6686111000,
-65.7372222000 -96.5516666000,
-65.8502777000 -96.5461111000,
-65.8527777000 -96.6627777000,
-65.7402776999 -96.6686111000))'));
INSERT INTO t1 (c1) VALUES (
PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
-18.6055555000 -66.8158332999,
-18.7186111000 -66.8102777000,
-18.7211111000 -66.9269443999,
-18.6086111000 -66.9327777000))'));
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
CREATE TABLE t1 (foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) ) row_format=dynamic;
INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(1,1)));
INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(1,0)));
INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(0,1)));
INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(0,0)));
SELECT 1 FROM t1 WHERE foo != PointFromWKB(POINT(0,0));
1
1
1
1
DROP TABLE t1;
CREATE TABLE t1 (id bigint(12) unsigned NOT NULL auto_increment,
c2 varchar(15) collate utf8_bin default NULL,
c1 varchar(15) collate utf8_bin default NULL,
c3 varchar(10) collate utf8_bin default NULL,
spatial_point point NOT NULL,
PRIMARY KEY(id),
SPATIAL KEY (spatial_point)
)row_format=dynamic DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
INSERT INTO t1 (c2, c1, c3, spatial_point) VALUES
('y', 's', 'j', GeomFromText('POINT(167 74)')),
('r', 'n', 'd', GeomFromText('POINT(215 118)')),
('g', 'n', 'e', GeomFromText('POINT(203 98)')),
('h', 'd', 'd', GeomFromText('POINT(54 193)')),
('r', 'x', 'y', GeomFromText('POINT(47 69)')),
('t', 'q', 'r', GeomFromText('POINT(109 42)')),
('a', 'z', 'd', GeomFromText('POINT(0 154)')),
('x', 'v', 'o', GeomFromText('POINT(174 131)')),
('b', 'r', 'a', GeomFromText('POINT(114 253)')),
('x', 'z', 'i', GeomFromText('POINT(163 21)')),
('w', 'p', 'i', GeomFromText('POINT(42 102)')),
('g', 'j', 'j', GeomFromText('POINT(170 133)')),
('m', 'g', 'n', GeomFromText('POINT(28 22)')),
('b', 'z', 'h', GeomFromText('POINT(174 28)')),
('q', 'k', 'f', GeomFromText('POINT(233 73)')),
('w', 'w', 'a', GeomFromText('POINT(124 200)')),
('t', 'j', 'w', GeomFromText('POINT(252 101)')),
('d', 'r', 'd', GeomFromText('POINT(98 18)')),
('w', 'o', 'y', GeomFromText('POINT(165 31)')),
('y', 'h', 't', GeomFromText('POINT(14 220)')),
('d', 'p', 'u', GeomFromText('POINT(223 196)')),
('g', 'y', 'g', GeomFromText('POINT(207 96)')),
('x', 'm', 'n', GeomFromText('POINT(214 3)')),
('g', 'v', 'e', GeomFromText('POINT(140 205)')),
('g', 'm', 'm', GeomFromText('POINT(10 236)')),
('i', 'r', 'j', GeomFromText('POINT(137 228)')),
('w', 's', 'p', GeomFromText('POINT(115 6)')),
('o', 'n', 'k', GeomFromText('POINT(158 129)')),
('j', 'h', 'l', GeomFromText('POINT(129 72)')),
('f', 'x', 'l', GeomFromText('POINT(139 207)')),
('u', 'd', 'n', GeomFromText('POINT(125 109)')),
('b', 'a', 'z', GeomFromText('POINT(30 32)')),
('m', 'h', 'o', GeomFromText('POINT(251 251)')),
('f', 'r', 'd', GeomFromText('POINT(243 211)')),
('b', 'd', 'r', GeomFromText('POINT(232 80)')),
('g', 'k', 'v', GeomFromText('POINT(15 100)')),
('i', 'f', 'c', GeomFromText('POINT(109 66)')),
('r', 't', 'j', GeomFromText('POINT(178 6)')),
('y', 'n', 'f', GeomFromText('POINT(233 211)')),
('f', 'y', 'm', GeomFromText('POINT(99 16)')),
('z', 'q', 'l', GeomFromText('POINT(39 49)')),
('j', 'c', 'r', GeomFromText('POINT(75 187)')),
('c', 'y', 'y', GeomFromText('POINT(246 253)')),
('w', 'u', 'd', GeomFromText('POINT(56 190)')),
('n', 'q', 'm', GeomFromText('POINT(73 149)')),
('d', 'y', 'a', GeomFromText('POINT(134 6)')),
('z', 's', 'w', GeomFromText('POINT(216 225)')),
('d', 'u', 'k', GeomFromText('POINT(132 70)')),
('f', 'v', 't', GeomFromText('POINT(187 141)')),
('r', 'r', 'a', GeomFromText('POINT(152 39)')),
('y', 'p', 'o', GeomFromText('POINT(45 27)')),
('p', 'n', 'm', GeomFromText('POINT(228 148)')),
('e', 'g', 'e', GeomFromText('POINT(88 81)')),
('m', 'a', 'h', GeomFromText('POINT(35 29)')),
('m', 'h', 'f', GeomFromText('POINT(30 71)')),
('h', 'k', 'i', GeomFromText('POINT(244 78)')),
('z', 'v', 'd', GeomFromText('POINT(241 38)')),
('q', 'l', 'j', GeomFromText('POINT(13 71)')),
('s', 'p', 'g', GeomFromText('POINT(108 38)')),
('q', 's', 'j', GeomFromText('POINT(92 101)')),
('l', 'h', 'g', GeomFromText('POINT(120 78)')),
('w', 't', 'b', GeomFromText('POINT(193 109)')),
('b', 's', 's', GeomFromText('POINT(223 211)')),
('w', 'w', 'y', GeomFromText('POINT(122 42)')),
('q', 'c', 'c', GeomFromText('POINT(104 102)')),
('w', 'g', 'n', GeomFromText('POINT(213 120)')),
('p', 'q', 'a', GeomFromText('POINT(247 148)')),
('c', 'z', 'e', GeomFromText('POINT(18 106)')),
('z', 'u', 'n', GeomFromText('POINT(70 133)')),
('j', 'n', 'x', GeomFromText('POINT(232 13)')),
('e', 'h', 'f', GeomFromText('POINT(22 135)')),
('w', 'l', 'f', GeomFromText('POINT(9 180)')),
('a', 'v', 'q', GeomFromText('POINT(163 228)')),
('i', 'z', 'o', GeomFromText('POINT(180 100)')),
('e', 'c', 'l', GeomFromText('POINT(182 231)')),
('c', 'k', 'o', GeomFromText('POINT(19 60)')),
('q', 'f', 'p', GeomFromText('POINT(79 95)')),
('m', 'd', 'r', GeomFromText('POINT(3 127)')),
('m', 'e', 't', GeomFromText('POINT(136 154)')),
('w', 'w', 'w', GeomFromText('POINT(102 15)')),
('l', 'n', 'q', GeomFromText('POINT(71 196)')),
('p', 'k', 'c', GeomFromText('POINT(47 139)')),
('j', 'o', 'r', GeomFromText('POINT(177 128)')),
('j', 'q', 'a', GeomFromText('POINT(170 6)')),
('b', 'a', 'o', GeomFromText('POINT(63 211)')),
('g', 's', 'o', GeomFromText('POINT(144 251)')),
('w', 'u', 'w', GeomFromText('POINT(221 214)')),
('g', 'a', 'm', GeomFromText('POINT(14 102)')),
('u', 'q', 'z', GeomFromText('POINT(86 200)')),
('k', 'a', 'm', GeomFromText('POINT(144 222)')),
('j', 'u', 'r', GeomFromText('POINT(216 142)')),
('q', 'k', 'v', GeomFromText('POINT(121 236)')),
('p', 'o', 'r', GeomFromText('POINT(108 102)')),
('b', 'd', 'x', GeomFromText('POINT(127 198)')),
('k', 's', 'a', GeomFromText('POINT(2 150)')),
('f', 'm', 'f', GeomFromText('POINT(160 191)')),
('q', 'y', 'x', GeomFromText('POINT(98 111)')),
('o', 'f', 'm', GeomFromText('POINT(232 218)')),
('c', 'w', 'j', GeomFromText('POINT(156 165)')),
('s', 'q', 'v', GeomFromText('POINT(98 161)'));
SET @@RAND_SEED1=692635050, @@RAND_SEED2=297339954;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
SET @@RAND_SEED1=159925977, @@RAND_SEED2=942570618;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
SET @@RAND_SEED1=328169745, @@RAND_SEED2=410451954;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
SET @@RAND_SEED1=178507359, @@RAND_SEED2=332493072;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
SET @@RAND_SEED1=1034033013, @@RAND_SEED2=558966507;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
UPDATE t1 set spatial_point=GeomFromText('POINT(230 9)') where c1 like 'y%';
UPDATE t1 set spatial_point=GeomFromText('POINT(95 35)') where c1 like 'j%';
UPDATE t1 set spatial_point=GeomFromText('POINT(93 99)') where c1 like 'a%';
UPDATE t1 set spatial_point=GeomFromText('POINT(19 81)') where c1 like 'r%';
UPDATE t1 set spatial_point=GeomFromText('POINT(20 177)') where c1 like 'h%';
UPDATE t1 set spatial_point=GeomFromText('POINT(221 193)') where c1 like 'u%';
UPDATE t1 set spatial_point=GeomFromText('POINT(195 205)') where c1 like 'd%';
UPDATE t1 set spatial_point=GeomFromText('POINT(15 213)') where c1 like 'u%';
UPDATE t1 set spatial_point=GeomFromText('POINT(214 63)') where c1 like 'n%';
UPDATE t1 set spatial_point=GeomFromText('POINT(243 171)') where c1 like 'c%';
UPDATE t1 set spatial_point=GeomFromText('POINT(198 82)') where c1 like 'y%';
INSERT INTO t1 (c2, c1, c3, spatial_point) VALUES
('f', 'y', 'p', GeomFromText('POINT(109 235)')),
('b', 'e', 'v', GeomFromText('POINT(20 48)')),
('i', 'u', 'f', GeomFromText('POINT(15 55)')),
('o', 'r', 'z', GeomFromText('POINT(105 64)')),
('a', 'p', 'a', GeomFromText('POINT(142 236)')),
('g', 'i', 'k', GeomFromText('POINT(10 49)')),
('x', 'z', 'x', GeomFromText('POINT(192 200)')),
('c', 'v', 'r', GeomFromText('POINT(94 168)')),
('y', 'z', 'e', GeomFromText('POINT(141 51)')),
('h', 'm', 'd', GeomFromText('POINT(35 251)')),
('v', 'm', 'q', GeomFromText('POINT(44 90)')),
('j', 'l', 'z', GeomFromText('POINT(67 237)')),
('i', 'v', 'a', GeomFromText('POINT(75 14)')),
('b', 'q', 't', GeomFromText('POINT(153 33)')),
('e', 'm', 'a', GeomFromText('POINT(247 49)')),
('l', 'y', 'g', GeomFromText('POINT(56 203)')),
('v', 'o', 'r', GeomFromText('POINT(90 54)')),
('r', 'n', 'd', GeomFromText('POINT(135 83)')),
('j', 't', 'u', GeomFromText('POINT(174 239)')),
('u', 'n', 'g', GeomFromText('POINT(104 191)')),
('p', 'q', 'y', GeomFromText('POINT(63 171)')),
('o', 'q', 'p', GeomFromText('POINT(192 103)')),
('f', 'x', 'e', GeomFromText('POINT(244 30)')),
('n', 'x', 'c', GeomFromText('POINT(92 103)')),
('r', 'q', 'z', GeomFromText('POINT(166 20)')),
('s', 'a', 'j', GeomFromText('POINT(137 205)')),
('z', 't', 't', GeomFromText('POINT(99 134)')),
('o', 'm', 'j', GeomFromText('POINT(217 3)')),
('n', 'h', 'j', GeomFromText('POINT(211 17)')),
('v', 'v', 'a', GeomFromText('POINT(41 137)')),
('q', 'o', 'j', GeomFromText('POINT(5 92)')),
('z', 'y', 'e', GeomFromText('POINT(175 212)')),
('j', 'z', 'h', GeomFromText('POINT(224 194)')),
('a', 'g', 'm', GeomFromText('POINT(31 119)')),
('p', 'c', 'f', GeomFromText('POINT(17 221)')),
('t', 'h', 'k', GeomFromText('POINT(26 203)')),
('u', 'w', 'p', GeomFromText('POINT(47 185)')),
('z', 'a', 'c', GeomFromText('POINT(61 133)')),
('u', 'k', 'a', GeomFromText('POINT(210 115)')),
('k', 'f', 'h', GeomFromText('POINT(125 113)')),
('t', 'v', 'y', GeomFromText('POINT(12 239)')),
('u', 'v', 'd', GeomFromText('POINT(90 24)')),
('m', 'y', 'w', GeomFromText('POINT(25 243)')),
('d', 'n', 'g', GeomFromText('POINT(122 92)')),
('z', 'm', 'f', GeomFromText('POINT(235 110)')),
('q', 'd', 'f', GeomFromText('POINT(233 217)')),
('a', 'v', 'u', GeomFromText('POINT(69 59)')),
('x', 'k', 'p', GeomFromText('POINT(240 14)')),
('i', 'v', 'r', GeomFromText('POINT(154 42)')),
('w', 'h', 'l', GeomFromText('POINT(178 156)')),
('d', 'h', 'n', GeomFromText('POINT(65 157)')),
('c', 'k', 'z', GeomFromText('POINT(62 33)')),
('e', 'l', 'w', GeomFromText('POINT(162 1)')),
('r', 'f', 'i', GeomFromText('POINT(127 71)')),
('q', 'm', 'c', GeomFromText('POINT(63 118)')),
('c', 'h', 'u', GeomFromText('POINT(205 203)')),
('d', 't', 'p', GeomFromText('POINT(234 87)')),
('s', 'g', 'h', GeomFromText('POINT(149 34)')),
('o', 'b', 'q', GeomFromText('POINT(159 179)')),
('k', 'u', 'f', GeomFromText('POINT(202 254)')),
('u', 'f', 'g', GeomFromText('POINT(70 15)')),
('x', 's', 'b', GeomFromText('POINT(25 181)')),
('s', 'c', 'g', GeomFromText('POINT(252 17)')),
('a', 'c', 'f', GeomFromText('POINT(89 67)')),
('r', 'e', 'q', GeomFromText('POINT(55 54)')),
('f', 'i', 'k', GeomFromText('POINT(178 230)')),
('p', 'e', 'l', GeomFromText('POINT(198 28)')),
('w', 'o', 'd', GeomFromText('POINT(204 189)')),
('c', 'a', 'g', GeomFromText('POINT(230 178)')),
('r', 'o', 'e', GeomFromText('POINT(61 116)')),
('w', 'a', 'a', GeomFromText('POINT(178 237)')),
('v', 'd', 'e', GeomFromText('POINT(70 85)')),
('k', 'c', 'e', GeomFromText('POINT(147 118)')),
('d', 'q', 't', GeomFromText('POINT(218 77)')),
('k', 'g', 'f', GeomFromText('POINT(192 113)')),
('w', 'n', 'e', GeomFromText('POINT(92 124)')),
('r', 'm', 'q', GeomFromText('POINT(130 65)')),
('o', 'r', 'r', GeomFromText('POINT(174 233)')),
('k', 'n', 't', GeomFromText('POINT(175 147)')),
('q', 'm', 'r', GeomFromText('POINT(18 208)')),
('l', 'd', 'i', GeomFromText('POINT(13 104)')),
('w', 'o', 'y', GeomFromText('POINT(207 39)')),
('p', 'u', 'o', GeomFromText('POINT(114 31)')),
('y', 'a', 'p', GeomFromText('POINT(106 59)')),
('a', 'x', 'z', GeomFromText('POINT(17 57)')),
('v', 'h', 'x', GeomFromText('POINT(170 13)')),
('t', 's', 'u', GeomFromText('POINT(84 18)')),
('z', 'z', 'f', GeomFromText('POINT(250 197)')),
('l', 'z', 't', GeomFromText('POINT(59 80)')),
('j', 'g', 's', GeomFromText('POINT(54 26)')),
('g', 'v', 'm', GeomFromText('POINT(89 98)')),
('q', 'v', 'b', GeomFromText('POINT(39 240)')),
('x', 'k', 'v', GeomFromText('POINT(246 207)')),
('k', 'u', 'i', GeomFromText('POINT(105 111)')),
('w', 'z', 's', GeomFromText('POINT(235 8)')),
('d', 'd', 'd', GeomFromText('POINT(105 4)')),
('c', 'z', 'q', GeomFromText('POINT(13 140)')),
('m', 'k', 'i', GeomFromText('POINT(208 120)')),
('g', 'a', 'g', GeomFromText('POINT(9 182)')),
('z', 'j', 'r', GeomFromText('POINT(149 153)')),
('h', 'f', 'g', GeomFromText('POINT(81 236)')),
('m', 'e', 'q', GeomFromText('POINT(209 215)')),
('c', 'h', 'y', GeomFromText('POINT(235 70)')),
('i', 'e', 'g', GeomFromText('POINT(138 26)')),
('m', 't', 'u', GeomFromText('POINT(119 237)')),
('o', 'w', 's', GeomFromText('POINT(193 166)')),
('f', 'm', 'q', GeomFromText('POINT(85 96)')),
('x', 'l', 'x', GeomFromText('POINT(58 115)')),
('x', 'q', 'u', GeomFromText('POINT(108 210)')),
('b', 'h', 'i', GeomFromText('POINT(250 139)')),
('y', 'd', 'x', GeomFromText('POINT(199 135)')),
('w', 'h', 'p', GeomFromText('POINT(247 233)')),
('p', 'z', 't', GeomFromText('POINT(148 249)')),
('q', 'a', 'u', GeomFromText('POINT(174 78)')),
('v', 't', 'm', GeomFromText('POINT(70 228)')),
('t', 'n', 'f', GeomFromText('POINT(123 2)')),
('x', 't', 'b', GeomFromText('POINT(35 50)')),
('r', 'j', 'f', GeomFromText('POINT(200 51)')),
('s', 'q', 'o', GeomFromText('POINT(23 184)')),
('u', 'v', 'z', GeomFromText('POINT(7 113)')),
('v', 'u', 'l', GeomFromText('POINT(145 190)')),
('o', 'k', 'i', GeomFromText('POINT(161 122)')),
('l', 'y', 'e', GeomFromText('POINT(17 232)')),
('t', 'b', 'e', GeomFromText('POINT(120 50)')),
('e', 's', 'u', GeomFromText('POINT(254 1)')),
('d', 'd', 'u', GeomFromText('POINT(167 140)')),
('o', 'b', 'x', GeomFromText('POINT(186 237)')),
('m', 's', 's', GeomFromText('POINT(172 149)')),
('t', 'y', 'a', GeomFromText('POINT(149 85)')),
('x', 't', 'r', GeomFromText('POINT(10 165)')),
('g', 'c', 'e', GeomFromText('POINT(95 165)')),
('e', 'e', 'z', GeomFromText('POINT(98 65)')),
('f', 'v', 'i', GeomFromText('POINT(149 144)')),
('o', 'p', 'm', GeomFromText('POINT(233 67)')),
('t', 'u', 'b', GeomFromText('POINT(109 215)')),
('o', 'o', 'b', GeomFromText('POINT(130 48)')),
('e', 'm', 'h', GeomFromText('POINT(88 189)')),
('e', 'v', 'y', GeomFromText('POINT(55 29)')),
('e', 't', 'm', GeomFromText('POINT(129 55)')),
('p', 'p', 'i', GeomFromText('POINT(126 222)')),
('c', 'i', 'c', GeomFromText('POINT(19 158)')),
('c', 'b', 's', GeomFromText('POINT(13 19)')),
('u', 'y', 'a', GeomFromText('POINT(114 5)')),
('a', 'o', 'f', GeomFromText('POINT(227 232)')),
('t', 'c', 'z', GeomFromText('POINT(63 62)')),
('d', 'o', 'k', GeomFromText('POINT(48 228)')),
('x', 'c', 'e', GeomFromText('POINT(204 2)')),
('e', 'e', 'g', GeomFromText('POINT(125 43)')),
('o', 'r', 'f', GeomFromText('POINT(171 140)'));
UPDATE t1 set spatial_point=GeomFromText('POINT(163 157)') where c1 like 'w%';
UPDATE t1 set spatial_point=GeomFromText('POINT(53 151)') where c1 like 'd%';
UPDATE t1 set spatial_point=GeomFromText('POINT(96 183)') where c1 like 'r%';
UPDATE t1 set spatial_point=GeomFromText('POINT(57 91)') where c1 like 'q%';
UPDATE t1 set spatial_point=GeomFromText('POINT(202 110)') where c1 like 'c%';
UPDATE t1 set spatial_point=GeomFromText('POINT(120 137)') where c1 like 'w%';
UPDATE t1 set spatial_point=GeomFromText('POINT(207 147)') where c1 like 'c%';
UPDATE t1 set spatial_point=GeomFromText('POINT(31 125)') where c1 like 'e%';
UPDATE t1 set spatial_point=GeomFromText('POINT(27 36)') where c1 like 'r%';
INSERT INTO t1 (c2, c1, c3, spatial_point) VALUES
('b', 'c', 'e', GeomFromText('POINT(41 137)')),
('p', 'y', 'k', GeomFromText('POINT(50 22)')),
('s', 'c', 'h', GeomFromText('POINT(208 173)')),
('x', 'u', 'l', GeomFromText('POINT(199 175)')),
('s', 'r', 'h', GeomFromText('POINT(85 192)')),
('j', 'k', 'u', GeomFromText('POINT(18 25)')),
('p', 'w', 'h', GeomFromText('POINT(152 197)')),
('e', 'd', 'c', GeomFromText('POINT(229 3)')),
('o', 'x', 'k', GeomFromText('POINT(187 155)')),
('o', 'b', 'k', GeomFromText('POINT(208 150)')),
('d', 'a', 'j', GeomFromText('POINT(70 87)')),
('f', 'e', 'k', GeomFromText('POINT(156 96)')),
('u', 'y', 'p', GeomFromText('POINT(239 193)')),
('n', 'v', 'p', GeomFromText('POINT(223 98)')),
('z', 'j', 'r', GeomFromText('POINT(87 89)')),
('h', 'x', 'x', GeomFromText('POINT(92 0)')),
('r', 'v', 'r', GeomFromText('POINT(159 139)')),
('v', 'g', 'g', GeomFromText('POINT(16 229)')),
('z', 'k', 'u', GeomFromText('POINT(99 52)')),
('p', 'p', 'o', GeomFromText('POINT(105 125)')),
('w', 'h', 'y', GeomFromText('POINT(105 154)')),
('v', 'y', 'z', GeomFromText('POINT(134 238)')),
('x', 'o', 'o', GeomFromText('POINT(178 88)')),
('z', 'w', 'd', GeomFromText('POINT(123 60)')),
('q', 'f', 'u', GeomFromText('POINT(64 90)')),
('s', 'n', 't', GeomFromText('POINT(50 138)')),
('v', 'p', 't', GeomFromText('POINT(114 91)')),
('a', 'o', 'n', GeomFromText('POINT(78 43)')),
('k', 'u', 'd', GeomFromText('POINT(185 161)')),
('w', 'd', 'n', GeomFromText('POINT(25 92)')),
('k', 'w', 'a', GeomFromText('POINT(59 238)')),
('t', 'c', 'f', GeomFromText('POINT(65 87)')),
('g', 's', 'p', GeomFromText('POINT(238 126)')),
('d', 'n', 'y', GeomFromText('POINT(107 173)')),
('l', 'a', 'w', GeomFromText('POINT(125 152)')),
('m', 'd', 'j', GeomFromText('POINT(146 53)')),
('q', 'm', 'c', GeomFromText('POINT(217 187)')),
('i', 'r', 'r', GeomFromText('POINT(6 113)')),
('e', 'j', 'b', GeomFromText('POINT(37 83)')),
('w', 'w', 'h', GeomFromText('POINT(83 199)')),
('k', 'b', 's', GeomFromText('POINT(170 64)')),
('s', 'b', 'c', GeomFromText('POINT(163 130)')),
('c', 'h', 'a', GeomFromText('POINT(141 3)')),
('k', 'j', 'u', GeomFromText('POINT(143 76)')),
('r', 'h', 'o', GeomFromText('POINT(243 92)')),
('i', 'd', 'b', GeomFromText('POINT(205 13)')),
('r', 'y', 'q', GeomFromText('POINT(138 8)')),
('m', 'o', 'i', GeomFromText('POINT(36 45)')),
('v', 'g', 'm', GeomFromText('POINT(0 40)')),
('f', 'e', 'i', GeomFromText('POINT(76 6)')),
('c', 'q', 'q', GeomFromText('POINT(115 248)')),
('x', 'c', 'i', GeomFromText('POINT(29 74)')),
('l', 's', 't', GeomFromText('POINT(83 18)')),
('t', 't', 'a', GeomFromText('POINT(26 168)')),
('u', 'n', 'x', GeomFromText('POINT(200 110)')),
('j', 'b', 'd', GeomFromText('POINT(216 136)')),
('s', 'p', 'w', GeomFromText('POINT(38 156)')),
('f', 'b', 'v', GeomFromText('POINT(29 186)')),
('v', 'e', 'r', GeomFromText('POINT(149 40)')),
('v', 't', 'm', GeomFromText('POINT(184 24)')),
('y', 'g', 'a', GeomFromText('POINT(219 105)')),
('s', 'f', 'i', GeomFromText('POINT(114 130)')),
('e', 'q', 'h', GeomFromText('POINT(203 135)')),
('h', 'g', 'b', GeomFromText('POINT(9 208)')),
('o', 'l', 'r', GeomFromText('POINT(245 79)')),
('s', 's', 'v', GeomFromText('POINT(238 198)')),
('w', 'w', 'z', GeomFromText('POINT(209 232)')),
('v', 'd', 'n', GeomFromText('POINT(30 193)')),
('q', 'w', 'k', GeomFromText('POINT(133 18)')),
('o', 'h', 'o', GeomFromText('POINT(42 140)')),
('f', 'f', 'h', GeomFromText('POINT(145 1)')),
('u', 's', 'r', GeomFromText('POINT(70 62)')),
('x', 'n', 'q', GeomFromText('POINT(33 86)')),
('u', 'p', 'v', GeomFromText('POINT(232 220)')),
('z', 'e', 'a', GeomFromText('POINT(130 69)')),
('r', 'u', 'z', GeomFromText('POINT(243 241)')),
('b', 'n', 't', GeomFromText('POINT(120 12)')),
('u', 'f', 's', GeomFromText('POINT(190 212)')),
('a', 'd', 'q', GeomFromText('POINT(235 191)')),
('f', 'q', 'm', GeomFromText('POINT(176 2)')),
('n', 'c', 's', GeomFromText('POINT(218 163)')),
('e', 'm', 'h', GeomFromText('POINT(163 108)')),
('c', 'f', 'l', GeomFromText('POINT(220 115)')),
('c', 'v', 'q', GeomFromText('POINT(66 45)')),
('w', 'v', 'x', GeomFromText('POINT(251 220)')),
('f', 'w', 'z', GeomFromText('POINT(146 149)')),
('h', 'n', 'h', GeomFromText('POINT(148 128)')),
('y', 'k', 'v', GeomFromText('POINT(28 110)')),
('c', 'x', 'q', GeomFromText('POINT(13 13)')),
('e', 'd', 's', GeomFromText('POINT(91 190)')),
('c', 'w', 'c', GeomFromText('POINT(10 231)')),
('u', 'j', 'n', GeomFromText('POINT(250 21)')),
('w', 'n', 'x', GeomFromText('POINT(141 69)')),
('f', 'p', 'y', GeomFromText('POINT(228 246)')),
('d', 'q', 'f', GeomFromText('POINT(194 22)')),
('d', 'z', 'l', GeomFromText('POINT(233 181)')),
('c', 'a', 'q', GeomFromText('POINT(183 96)')),
('m', 'i', 'd', GeomFromText('POINT(117 226)')),
('z', 'y', 'y', GeomFromText('POINT(62 81)')),
('g', 'v', 'm', GeomFromText('POINT(66 158)'));
SET @@RAND_SEED1=481064922, @@RAND_SEED2=438133497;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
SET @@RAND_SEED1=280535103, @@RAND_SEED2=444518646;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
SET @@RAND_SEED1=1072017234, @@RAND_SEED2=484203885;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
SET @@RAND_SEED1=358851897, @@RAND_SEED2=358495224;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
SET @@RAND_SEED1=509031459, @@RAND_SEED2=675962925;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
UPDATE t1 set spatial_point=GeomFromText('POINT(61 203)') where c1 like 'y%';
UPDATE t1 set spatial_point=GeomFromText('POINT(202 194)') where c1 like 'f%';
UPDATE t1 set spatial_point=GeomFromText('POINT(228 18)') where c1 like 'h%';
UPDATE t1 set spatial_point=GeomFromText('POINT(88 18)') where c1 like 'l%';
UPDATE t1 set spatial_point=GeomFromText('POINT(176 94)') where c1 like 'e%';
UPDATE t1 set spatial_point=GeomFromText('POINT(44 47)') where c1 like 'g%';
UPDATE t1 set spatial_point=GeomFromText('POINT(95 191)') where c1 like 'b%';
UPDATE t1 set spatial_point=GeomFromText('POINT(179 218)') where c1 like 'y%';
UPDATE t1 set spatial_point=GeomFromText('POINT(239 40)') where c1 like 'g%';
UPDATE t1 set spatial_point=GeomFromText('POINT(248 41)') where c1 like 'q%';
UPDATE t1 set spatial_point=GeomFromText('POINT(167 82)') where c1 like 't%';
UPDATE t1 set spatial_point=GeomFromText('POINT(13 104)') where c1 like 'u%';
UPDATE t1 set spatial_point=GeomFromText('POINT(139 84)') where c1 like 'a%';
UPDATE t1 set spatial_point=GeomFromText('POINT(145 108)') where c1 like 'p%';
UPDATE t1 set spatial_point=GeomFromText('POINT(147 57)') where c1 like 't%';
UPDATE t1 set spatial_point=GeomFromText('POINT(217 144)') where c1 like 'n%';
UPDATE t1 set spatial_point=GeomFromText('POINT(160 224)') where c1 like 'w%';
UPDATE t1 set spatial_point=GeomFromText('POINT(38 28)') where c1 like 'j%';
UPDATE t1 set spatial_point=GeomFromText('POINT(104 114)') where c1 like 'q%';
UPDATE t1 set spatial_point=GeomFromText('POINT(88 19)') where c1 like 'c%';
INSERT INTO t1 (c2, c1, c3, spatial_point) VALUES
('f', 'x', 'p', GeomFromText('POINT(92 181)')),
('s', 'i', 'c', GeomFromText('POINT(49 60)')),
('c', 'c', 'i', GeomFromText('POINT(7 57)')),
('n', 'g', 'k', GeomFromText('POINT(252 105)')),
('g', 'b', 'm', GeomFromText('POINT(180 11)')),
('u', 'l', 'r', GeomFromText('POINT(32 90)')),
('c', 'x', 'e', GeomFromText('POINT(143 24)')),
('x', 'u', 'a', GeomFromText('POINT(123 92)')),
('s', 'b', 'h', GeomFromText('POINT(190 108)')),
('c', 'x', 'b', GeomFromText('POINT(104 100)')),
('i', 'd', 't', GeomFromText('POINT(214 104)')),
('r', 'w', 'g', GeomFromText('POINT(29 67)')),
('b', 'f', 'g', GeomFromText('POINT(149 46)')),
('r', 'r', 'd', GeomFromText('POINT(242 196)')),
('j', 'l', 'a', GeomFromText('POINT(90 196)')),
('e', 't', 'b', GeomFromText('POINT(190 64)')),
('l', 'x', 'w', GeomFromText('POINT(250 73)')),
('q', 'y', 'r', GeomFromText('POINT(120 182)')),
('s', 'j', 'a', GeomFromText('POINT(180 175)')),
('n', 'i', 'y', GeomFromText('POINT(124 136)')),
('s', 'x', 's', GeomFromText('POINT(176 209)')),
('u', 'f', 's', GeomFromText('POINT(215 173)')),
('m', 'j', 'x', GeomFromText('POINT(44 140)')),
('v', 'g', 'x', GeomFromText('POINT(177 233)')),
('u', 't', 'b', GeomFromText('POINT(136 197)')),
('f', 'g', 'b', GeomFromText('POINT(10 8)')),
('v', 'c', 'j', GeomFromText('POINT(13 81)')),
('d', 's', 'q', GeomFromText('POINT(200 100)')),
('a', 'p', 'j', GeomFromText('POINT(33 40)')),
('i', 'c', 'g', GeomFromText('POINT(168 204)')),
('k', 'h', 'i', GeomFromText('POINT(93 243)')),
('s', 'b', 's', GeomFromText('POINT(157 13)')),
('v', 'l', 'l', GeomFromText('POINT(103 6)')),
('r', 'b', 'k', GeomFromText('POINT(244 137)')),
('l', 'd', 'r', GeomFromText('POINT(162 254)')),
('q', 'b', 'z', GeomFromText('POINT(136 246)')),
('x', 'x', 'p', GeomFromText('POINT(120 37)')),
('m', 'e', 'z', GeomFromText('POINT(203 167)')),
('q', 'n', 'p', GeomFromText('POINT(94 119)')),
('b', 'g', 'u', GeomFromText('POINT(93 248)')),
('r', 'v', 'v', GeomFromText('POINT(53 88)')),
('y', 'a', 'i', GeomFromText('POINT(98 219)')),
('a', 's', 'g', GeomFromText('POINT(173 138)')),
('c', 'a', 't', GeomFromText('POINT(235 135)')),
('q', 'm', 'd', GeomFromText('POINT(224 208)')),
('e', 'p', 'k', GeomFromText('POINT(161 238)')),
('n', 'g', 'q', GeomFromText('POINT(35 204)')),
('t', 't', 'x', GeomFromText('POINT(230 178)')),
('w', 'f', 'a', GeomFromText('POINT(150 221)')),
('z', 'm', 'z', GeomFromText('POINT(119 42)')),
('l', 'j', 's', GeomFromText('POINT(97 96)')),
('f', 'z', 'x', GeomFromText('POINT(208 65)')),
('i', 'v', 'c', GeomFromText('POINT(145 79)')),
('l', 'f', 'k', GeomFromText('POINT(83 234)')),
('u', 'a', 's', GeomFromText('POINT(250 49)')),
('o', 'k', 'p', GeomFromText('POINT(46 50)')),
('d', 'e', 'z', GeomFromText('POINT(30 198)')),
('r', 'r', 'l', GeomFromText('POINT(78 189)')),
('y', 'l', 'f', GeomFromText('POINT(188 132)')),
('d', 'q', 'm', GeomFromText('POINT(247 107)')),
('p', 'j', 'n', GeomFromText('POINT(148 227)')),
('b', 'o', 'i', GeomFromText('POINT(172 25)')),
('e', 'v', 'd', GeomFromText('POINT(94 248)')),
('q', 'd', 'f', GeomFromText('POINT(15 29)')),
('w', 'b', 'b', GeomFromText('POINT(74 111)')),
('g', 'q', 'f', GeomFromText('POINT(107 215)')),
('o', 'h', 'r', GeomFromText('POINT(25 168)')),
('u', 't', 'w', GeomFromText('POINT(251 188)')),
('h', 's', 'w', GeomFromText('POINT(254 247)')),
('f', 'f', 'b', GeomFromText('POINT(166 103)'));
SET @@RAND_SEED1=866613816, @@RAND_SEED2=92289615;
INSERT INTO t1 (c2, c1, c3, spatial_point) VALUES
('l', 'c', 'l', GeomFromText('POINT(202 98)')),
('k', 'c', 'b', GeomFromText('POINT(46 206)')),
('r', 'y', 'm', GeomFromText('POINT(74 140)')),
('y', 'z', 'd', GeomFromText('POINT(200 160)')),
('s', 'y', 's', GeomFromText('POINT(156 205)')),
('u', 'v', 'p', GeomFromText('POINT(86 82)')),
('j', 's', 's', GeomFromText('POINT(91 233)')),
('x', 'j', 'f', GeomFromText('POINT(3 14)')),
('l', 'z', 'v', GeomFromText('POINT(123 156)')),
('h', 'i', 'o', GeomFromText('POINT(145 229)')),
('o', 'r', 'd', GeomFromText('POINT(15 22)')),
('f', 'x', 't', GeomFromText('POINT(21 60)')),
('t', 'g', 'h', GeomFromText('POINT(50 153)')),
('g', 'u', 'b', GeomFromText('POINT(82 85)')),
('v', 'a', 'p', GeomFromText('POINT(231 178)')),
('n', 'v', 'o', GeomFromText('POINT(183 25)')),
('j', 'n', 'm', GeomFromText('POINT(50 144)')),
('e', 'f', 'i', GeomFromText('POINT(46 16)')),
('d', 'w', 'a', GeomFromText('POINT(66 6)')),
('f', 'x', 'a', GeomFromText('POINT(107 197)')),
('m', 'o', 'a', GeomFromText('POINT(142 80)')),
('q', 'l', 'g', GeomFromText('POINT(251 23)')),
('c', 's', 's', GeomFromText('POINT(158 43)')),
('y', 'd', 'o', GeomFromText('POINT(196 228)')),
('d', 'p', 'l', GeomFromText('POINT(107 5)')),
('h', 'a', 'b', GeomFromText('POINT(183 166)')),
('m', 'w', 'p', GeomFromText('POINT(19 59)')),
('b', 'y', 'o', GeomFromText('POINT(178 30)')),
('x', 'w', 'i', GeomFromText('POINT(168 94)')),
('t', 'k', 'z', GeomFromText('POINT(171 5)')),
('r', 'm', 'a', GeomFromText('POINT(222 19)')),
('u', 'v', 'e', GeomFromText('POINT(224 80)')),
('q', 'r', 'k', GeomFromText('POINT(212 218)')),
('d', 'p', 'j', GeomFromText('POINT(169 7)')),
('d', 'r', 'v', GeomFromText('POINT(193 23)')),
('n', 'y', 'y', GeomFromText('POINT(130 178)')),
('m', 'z', 'r', GeomFromText('POINT(81 200)')),
('j', 'e', 'w', GeomFromText('POINT(145 239)')),
('v', 'h', 'x', GeomFromText('POINT(24 105)')),
('z', 'm', 'a', GeomFromText('POINT(175 129)')),
('b', 'c', 'v', GeomFromText('POINT(213 10)')),
('t', 't', 'u', GeomFromText('POINT(2 129)')),
('r', 's', 'v', GeomFromText('POINT(209 192)')),
('x', 'p', 'g', GeomFromText('POINT(43 63)')),
('t', 'e', 'u', GeomFromText('POINT(139 210)')),
('l', 'e', 't', GeomFromText('POINT(245 148)')),
('a', 'i', 'k', GeomFromText('POINT(167 195)')),
('m', 'o', 'h', GeomFromText('POINT(206 120)')),
('g', 'z', 's', GeomFromText('POINT(169 240)')),
('z', 'u', 's', GeomFromText('POINT(202 120)')),
('i', 'b', 'a', GeomFromText('POINT(216 18)')),
('w', 'y', 'g', GeomFromText('POINT(119 236)')),
('h', 'y', 'p', GeomFromText('POINT(161 24)'));
UPDATE t1 set spatial_point=GeomFromText('POINT(33 100)') where c1 like 't%';
UPDATE t1 set spatial_point=GeomFromText('POINT(41 46)') where c1 like 'f%';
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
create table t1 (a geometry not null, spatial index(a)) row_format=dynamic;
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 131072)));
insert into t1 values (PointFromWKB(POINT(9.1248812352444e+192, 2.9740338169556e+284)));
insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, -0)));
insert into t1 values (PointFromWKB(POINT(1.49166814624e-154, 2.0880974297595e-53)));
insert into t1 values (PointFromWKB(POINT(4.0917382598702e+149, 1.2024538023802e+111)));
insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 2.9993936277913e-241)));
insert into t1 values (PointFromWKB(POINT(2.5243548967072e-29, 1.2024538023802e+111)));
insert into t1 values (PointFromWKB(POINT(0, 6.9835074892995e-251)));
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 3.1050361846014e+231)));
insert into t1 values (PointFromWKB(POINT(2.8728483499323e-188, 2.4600631144627e+260)));
insert into t1 values (PointFromWKB(POINT(3.0517578125e-05, 2.0349165139404e+236)));
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 1.1818212630766e-125)));
insert into t1 values (PointFromWKB(POINT(2.481040258324e-265, 5.7766220027675e-275)));
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 2.5243548967072e-29)));
insert into t1 values (PointFromWKB(POINT(5.7766220027675e-275, 9.9464647281957e+86)));
insert into t1 values (PointFromWKB(POINT(2.2181357552967e+130, 3.7857669957337e-270)));
insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.6893488147419e+19)));
insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.7537584144024e+255)));
insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 1.8033161362863e-130)));
insert into t1 values (PointFromWKB(POINT(0, 5.8774717541114e-39)));
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 2.2761049594727e-159)));
insert into t1 values (PointFromWKB(POINT(6.243497100632e+144, 3.7857669957337e-270)));
insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 2.6355494858076e-82)));
insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 3.8518598887745e-34)));
insert into t1 values (PointFromWKB(POINT(4.6566128730774e-10, 2.0880974297595e-53)));
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 1.8827498946116e-183)));
insert into t1 values (PointFromWKB(POINT(1.8033161362863e-130, 9.1248812352444e+192)));
insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, 2.2761049594727e-159)));
insert into t1 values (PointFromWKB(POINT(1.94906280228e+289, 1.2338789709327e-178)));
drop table t1;
CREATE TABLE t1(foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) ) row_format=dynamic;
INSERT INTO t1(foo) VALUES (NULL);
ERROR 23000: Column 'foo' cannot be null
INSERT INTO t1() VALUES ();
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
INSERT INTO t1(foo) VALUES ('');
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
DROP TABLE t1;
CREATE TABLE t1 (a INT AUTO_INCREMENT, b POINT NOT NULL, KEY (a), SPATIAL KEY (b)) row_format=dynamic;
INSERT INTO t1 (b) VALUES (GeomFromText('POINT(1 2)'));
INSERT INTO t1 (b) SELECT b FROM t1;
INSERT INTO t1 (b) SELECT b FROM t1;
INSERT INTO t1 (b) SELECT b FROM t1;
INSERT INTO t1 (b) SELECT b FROM t1;
INSERT INTO t1 (b) SELECT b FROM t1;
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
DROP TABLE t1;
CREATE TABLE t1 (a INT, b GEOMETRY NOT NULL, SPATIAL KEY b(b)) row_format=dynamic;
INSERT INTO t1 VALUES (1, GEOMFROMTEXT('LINESTRING(1102218.456 1,2000000 2)'));
INSERT INTO t1 VALUES (2, GEOMFROMTEXT('LINESTRING(1102218.456 1,2000000 2)'));
SELECT COUNT(*) FROM t1 WHERE
MBRINTERSECTS(b, GEOMFROMTEXT('LINESTRING(1 1,1102219 2)') );
COUNT(*)
2
SELECT COUNT(*) FROM t1 IGNORE INDEX (b) WHERE
MBRINTERSECTS(b, GEOMFROMTEXT('LINESTRING(1 1,1102219 2)') );
COUNT(*)
2
DROP TABLE t1;
End of 5.0 tests.
set storage_engine=maria;
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (
fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
g GEOMETRY NOT NULL,
SPATIAL KEY(g)
) transactional=1 row_format=page;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`fid` int(11) NOT NULL AUTO_INCREMENT,
`g` geometry NOT NULL,
PRIMARY KEY (`fid`),
SPATIAL KEY `g` (`g`)
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 ROW_FORMAT=PAGE TRANSACTIONAL=1
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(150 150, 150 150)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(149 149, 151 151)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(148 148, 152 152)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(147 147, 153 153)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(146 146, 154 154)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(145 145, 155 155)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(144 144, 156 156)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(143 143, 157 157)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(142 142, 158 158)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(141 141, 159 159)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(140 140, 160 160)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(139 139, 161 161)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(138 138, 162 162)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(137 137, 163 163)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(136 136, 164 164)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(135 135, 165 165)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(134 134, 166 166)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(133 133, 167 167)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(132 132, 168 168)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(131 131, 169 169)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(130 130, 170 170)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(129 129, 171 171)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(128 128, 172 172)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(127 127, 173 173)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(126 126, 174 174)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(125 125, 175 175)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(124 124, 176 176)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(123 123, 177 177)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(122 122, 178 178)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(121 121, 179 179)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(120 120, 180 180)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(119 119, 181 181)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(118 118, 182 182)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(117 117, 183 183)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(116 116, 184 184)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(115 115, 185 185)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(114 114, 186 186)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(113 113, 187 187)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(112 112, 188 188)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(111 111, 189 189)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(110 110, 190 190)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(109 109, 191 191)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(108 108, 192 192)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(107 107, 193 193)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(106 106, 194 194)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(105 105, 195 195)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(104 104, 196 196)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(103 103, 197 197)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(102 102, 198 198)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(101 101, 199 199)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(100 100, 200 200)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(99 99, 201 201)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(98 98, 202 202)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(97 97, 203 203)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(96 96, 204 204)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(95 95, 205 205)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(94 94, 206 206)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(93 93, 207 207)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(92 92, 208 208)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(91 91, 209 209)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(90 90, 210 210)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(89 89, 211 211)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(88 88, 212 212)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(87 87, 213 213)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(86 86, 214 214)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(85 85, 215 215)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(84 84, 216 216)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(83 83, 217 217)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(82 82, 218 218)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(81 81, 219 219)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(80 80, 220 220)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(79 79, 221 221)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(78 78, 222 222)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(77 77, 223 223)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(76 76, 224 224)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(75 75, 225 225)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(74 74, 226 226)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(73 73, 227 227)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(72 72, 228 228)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(71 71, 229 229)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(70 70, 230 230)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(69 69, 231 231)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(68 68, 232 232)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(67 67, 233 233)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(66 66, 234 234)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(65 65, 235 235)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(64 64, 236 236)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(63 63, 237 237)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(62 62, 238 238)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(61 61, 239 239)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(60 60, 240 240)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(59 59, 241 241)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(58 58, 242 242)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(57 57, 243 243)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(56 56, 244 244)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(55 55, 245 245)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(54 54, 246 246)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(53 53, 247 247)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(52 52, 248 248)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(51 51, 249 249)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(50 50, 250 250)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(49 49, 251 251)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(48 48, 252 252)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(47 47, 253 253)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(46 46, 254 254)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(45 45, 255 255)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(44 44, 256 256)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(43 43, 257 257)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(42 42, 258 258)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(41 41, 259 259)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(40 40, 260 260)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(39 39, 261 261)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(38 38, 262 262)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(37 37, 263 263)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(36 36, 264 264)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(35 35, 265 265)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(34 34, 266 266)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(33 33, 267 267)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(32 32, 268 268)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(31 31, 269 269)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(30 30, 270 270)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(29 29, 271 271)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(28 28, 272 272)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(27 27, 273 273)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(26 26, 274 274)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(25 25, 275 275)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(24 24, 276 276)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(23 23, 277 277)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(22 22, 278 278)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(21 21, 279 279)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(20 20, 280 280)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(19 19, 281 281)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(18 18, 282 282)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(17 17, 283 283)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(16 16, 284 284)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(15 15, 285 285)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(14 14, 286 286)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(13 13, 287 287)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(12 12, 288 288)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(11 11, 289 289)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(10 10, 290 290)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(9 9, 291 291)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(8 8, 292 292)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(7 7, 293 293)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(6 6, 294 294)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(5 5, 295 295)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(4 4, 296 296)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(3 3, 297 297)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(2 2, 298 298)'));
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(1 1, 299 299)'));
SELECT count(*) FROM t1;
count(*)
150
EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range g g 34 NULL 11 Using where
SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
fid AsText(g)
1 LINESTRING(150 150,150 150)
2 LINESTRING(149 149,151 151)
3 LINESTRING(148 148,152 152)
4 LINESTRING(147 147,153 153)
5 LINESTRING(146 146,154 154)
6 LINESTRING(145 145,155 155)
7 LINESTRING(144 144,156 156)
8 LINESTRING(143 143,157 157)
9 LINESTRING(142 142,158 158)
10 LINESTRING(141 141,159 159)
11 LINESTRING(140 140,160 160)
DROP TABLE t1;
CREATE TABLE t2 (
fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
g GEOMETRY NOT NULL
) transactional=1 row_format=page;
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 9 * 10 - 9), Point(10 * 10, 9 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 8 * 10 - 9), Point(10 * 10, 8 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 7 * 10 - 9), Point(10 * 10, 7 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 6 * 10 - 9), Point(10 * 10, 6 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 5 * 10 - 9), Point(10 * 10, 5 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 4 * 10 - 9), Point(10 * 10, 4 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 3 * 10 - 9), Point(10 * 10, 3 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 2 * 10 - 9), Point(10 * 10, 2 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 1 * 10 - 9), Point(10 * 10, 1 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 10 * 10 - 9), Point(9 * 10, 10 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 9 * 10 - 9), Point(9 * 10, 9 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 8 * 10 - 9), Point(9 * 10, 8 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 7 * 10 - 9), Point(9 * 10, 7 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 6 * 10 - 9), Point(9 * 10, 6 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 5 * 10 - 9), Point(9 * 10, 5 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 4 * 10 - 9), Point(9 * 10, 4 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 3 * 10 - 9), Point(9 * 10, 3 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 2 * 10 - 9), Point(9 * 10, 2 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(9 * 10 - 9, 1 * 10 - 9), Point(9 * 10, 1 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 10 * 10 - 9), Point(8 * 10, 10 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 9 * 10 - 9), Point(8 * 10, 9 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 8 * 10 - 9), Point(8 * 10, 8 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 7 * 10 - 9), Point(8 * 10, 7 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 6 * 10 - 9), Point(8 * 10, 6 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 5 * 10 - 9), Point(8 * 10, 5 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 4 * 10 - 9), Point(8 * 10, 4 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 3 * 10 - 9), Point(8 * 10, 3 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 2 * 10 - 9), Point(8 * 10, 2 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(8 * 10 - 9, 1 * 10 - 9), Point(8 * 10, 1 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 10 * 10 - 9), Point(7 * 10, 10 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 9 * 10 - 9), Point(7 * 10, 9 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 8 * 10 - 9), Point(7 * 10, 8 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 7 * 10 - 9), Point(7 * 10, 7 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 6 * 10 - 9), Point(7 * 10, 6 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 5 * 10 - 9), Point(7 * 10, 5 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 4 * 10 - 9), Point(7 * 10, 4 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 3 * 10 - 9), Point(7 * 10, 3 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 2 * 10 - 9), Point(7 * 10, 2 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(7 * 10 - 9, 1 * 10 - 9), Point(7 * 10, 1 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 10 * 10 - 9), Point(6 * 10, 10 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 9 * 10 - 9), Point(6 * 10, 9 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 8 * 10 - 9), Point(6 * 10, 8 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 7 * 10 - 9), Point(6 * 10, 7 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 6 * 10 - 9), Point(6 * 10, 6 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 5 * 10 - 9), Point(6 * 10, 5 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 4 * 10 - 9), Point(6 * 10, 4 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 3 * 10 - 9), Point(6 * 10, 3 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 2 * 10 - 9), Point(6 * 10, 2 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(6 * 10 - 9, 1 * 10 - 9), Point(6 * 10, 1 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 10 * 10 - 9), Point(5 * 10, 10 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 9 * 10 - 9), Point(5 * 10, 9 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 8 * 10 - 9), Point(5 * 10, 8 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 7 * 10 - 9), Point(5 * 10, 7 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 6 * 10 - 9), Point(5 * 10, 6 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 5 * 10 - 9), Point(5 * 10, 5 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 4 * 10 - 9), Point(5 * 10, 4 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 3 * 10 - 9), Point(5 * 10, 3 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 2 * 10 - 9), Point(5 * 10, 2 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(5 * 10 - 9, 1 * 10 - 9), Point(5 * 10, 1 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 10 * 10 - 9), Point(4 * 10, 10 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 9 * 10 - 9), Point(4 * 10, 9 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 8 * 10 - 9), Point(4 * 10, 8 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 7 * 10 - 9), Point(4 * 10, 7 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 6 * 10 - 9), Point(4 * 10, 6 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 5 * 10 - 9), Point(4 * 10, 5 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 4 * 10 - 9), Point(4 * 10, 4 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 3 * 10 - 9), Point(4 * 10, 3 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 2 * 10 - 9), Point(4 * 10, 2 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(4 * 10 - 9, 1 * 10 - 9), Point(4 * 10, 1 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 10 * 10 - 9), Point(3 * 10, 10 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 9 * 10 - 9), Point(3 * 10, 9 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 8 * 10 - 9), Point(3 * 10, 8 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 7 * 10 - 9), Point(3 * 10, 7 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 6 * 10 - 9), Point(3 * 10, 6 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 5 * 10 - 9), Point(3 * 10, 5 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 4 * 10 - 9), Point(3 * 10, 4 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 3 * 10 - 9), Point(3 * 10, 3 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 2 * 10 - 9), Point(3 * 10, 2 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(3 * 10 - 9, 1 * 10 - 9), Point(3 * 10, 1 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 10 * 10 - 9), Point(2 * 10, 10 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 9 * 10 - 9), Point(2 * 10, 9 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 8 * 10 - 9), Point(2 * 10, 8 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 7 * 10 - 9), Point(2 * 10, 7 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 6 * 10 - 9), Point(2 * 10, 6 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 5 * 10 - 9), Point(2 * 10, 5 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 4 * 10 - 9), Point(2 * 10, 4 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 3 * 10 - 9), Point(2 * 10, 3 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 2 * 10 - 9), Point(2 * 10, 2 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(2 * 10 - 9, 1 * 10 - 9), Point(2 * 10, 1 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 10 * 10 - 9), Point(1 * 10, 10 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 9 * 10 - 9), Point(1 * 10, 9 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 8 * 10 - 9), Point(1 * 10, 8 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 7 * 10 - 9), Point(1 * 10, 7 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 6 * 10 - 9), Point(1 * 10, 6 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 5 * 10 - 9), Point(1 * 10, 5 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 4 * 10 - 9), Point(1 * 10, 4 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 3 * 10 - 9), Point(1 * 10, 3 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 2 * 10 - 9), Point(1 * 10, 2 * 10))));
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(1 * 10 - 9, 1 * 10 - 9), Point(1 * 10, 1 * 10))));
ALTER TABLE t2 ADD SPATIAL KEY(g);
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`fid` int(11) NOT NULL AUTO_INCREMENT,
`g` geometry NOT NULL,
PRIMARY KEY (`fid`),
SPATIAL KEY `g` (`g`)
) ENGINE=MARIA AUTO_INCREMENT=101 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 ROW_FORMAT=PAGE TRANSACTIONAL=1
SELECT count(*) FROM t2;
count(*)
100
EXPLAIN SELECT fid, AsText(g) FROM t2 WHERE Within(g,
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range g g 34 NULL 4 Using where
SELECT fid, AsText(g) FROM t2 WHERE Within(g,
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
fid AsText(g)
45 LINESTRING(51 51,60 60)
46 LINESTRING(51 41,60 50)
55 LINESTRING(41 51,50 60)
56 LINESTRING(41 41,50 50)
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10)))));
SELECT count(*) FROM t2;
count(*)
99
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 9 * 10 - 9), Point(10 * 10, 9 * 10)))));
SELECT count(*) FROM t2;
count(*)
98
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 8 * 10 - 9), Point(10 * 10, 8 * 10)))));
SELECT count(*) FROM t2;
count(*)
97
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 7 * 10 - 9), Point(10 * 10, 7 * 10)))));
SELECT count(*) FROM t2;
count(*)
96
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 6 * 10 - 9), Point(10 * 10, 6 * 10)))));
SELECT count(*) FROM t2;
count(*)
95
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 5 * 10 - 9), Point(10 * 10, 5 * 10)))));
SELECT count(*) FROM t2;
count(*)
94
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 4 * 10 - 9), Point(10 * 10, 4 * 10)))));
SELECT count(*) FROM t2;
count(*)
93
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 3 * 10 - 9), Point(10 * 10, 3 * 10)))));
SELECT count(*) FROM t2;
count(*)
92
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 2 * 10 - 9), Point(10 * 10, 2 * 10)))));
SELECT count(*) FROM t2;
count(*)
91
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 1 * 10 - 9), Point(10 * 10, 1 * 10)))));
SELECT count(*) FROM t2;
count(*)
90
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 10 * 10 - 9), Point(9 * 10, 10 * 10)))));
SELECT count(*) FROM t2;
count(*)
89
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 9 * 10 - 9), Point(9 * 10, 9 * 10)))));
SELECT count(*) FROM t2;
count(*)
88
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 8 * 10 - 9), Point(9 * 10, 8 * 10)))));
SELECT count(*) FROM t2;
count(*)
87
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 7 * 10 - 9), Point(9 * 10, 7 * 10)))));
SELECT count(*) FROM t2;
count(*)
86
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 6 * 10 - 9), Point(9 * 10, 6 * 10)))));
SELECT count(*) FROM t2;
count(*)
85
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 5 * 10 - 9), Point(9 * 10, 5 * 10)))));
SELECT count(*) FROM t2;
count(*)
84
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 4 * 10 - 9), Point(9 * 10, 4 * 10)))));
SELECT count(*) FROM t2;
count(*)
83
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 3 * 10 - 9), Point(9 * 10, 3 * 10)))));
SELECT count(*) FROM t2;
count(*)
82
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 2 * 10 - 9), Point(9 * 10, 2 * 10)))));
SELECT count(*) FROM t2;
count(*)
81
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 1 * 10 - 9), Point(9 * 10, 1 * 10)))));
SELECT count(*) FROM t2;
count(*)
80
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 10 * 10 - 9), Point(8 * 10, 10 * 10)))));
SELECT count(*) FROM t2;
count(*)
79
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 9 * 10 - 9), Point(8 * 10, 9 * 10)))));
SELECT count(*) FROM t2;
count(*)
78
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 8 * 10 - 9), Point(8 * 10, 8 * 10)))));
SELECT count(*) FROM t2;
count(*)
77
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 7 * 10 - 9), Point(8 * 10, 7 * 10)))));
SELECT count(*) FROM t2;
count(*)
76
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 6 * 10 - 9), Point(8 * 10, 6 * 10)))));
SELECT count(*) FROM t2;
count(*)
75
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 5 * 10 - 9), Point(8 * 10, 5 * 10)))));
SELECT count(*) FROM t2;
count(*)
74
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 4 * 10 - 9), Point(8 * 10, 4 * 10)))));
SELECT count(*) FROM t2;
count(*)
73
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 3 * 10 - 9), Point(8 * 10, 3 * 10)))));
SELECT count(*) FROM t2;
count(*)
72
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 2 * 10 - 9), Point(8 * 10, 2 * 10)))));
SELECT count(*) FROM t2;
count(*)
71
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 1 * 10 - 9), Point(8 * 10, 1 * 10)))));
SELECT count(*) FROM t2;
count(*)
70
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 10 * 10 - 9), Point(7 * 10, 10 * 10)))));
SELECT count(*) FROM t2;
count(*)
69
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 9 * 10 - 9), Point(7 * 10, 9 * 10)))));
SELECT count(*) FROM t2;
count(*)
68
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 8 * 10 - 9), Point(7 * 10, 8 * 10)))));
SELECT count(*) FROM t2;
count(*)
67
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 7 * 10 - 9), Point(7 * 10, 7 * 10)))));
SELECT count(*) FROM t2;
count(*)
66
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 6 * 10 - 9), Point(7 * 10, 6 * 10)))));
SELECT count(*) FROM t2;
count(*)
65
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 5 * 10 - 9), Point(7 * 10, 5 * 10)))));
SELECT count(*) FROM t2;
count(*)
64
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 4 * 10 - 9), Point(7 * 10, 4 * 10)))));
SELECT count(*) FROM t2;
count(*)
63
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 3 * 10 - 9), Point(7 * 10, 3 * 10)))));
SELECT count(*) FROM t2;
count(*)
62
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 2 * 10 - 9), Point(7 * 10, 2 * 10)))));
SELECT count(*) FROM t2;
count(*)
61
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 1 * 10 - 9), Point(7 * 10, 1 * 10)))));
SELECT count(*) FROM t2;
count(*)
60
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 10 * 10 - 9), Point(6 * 10, 10 * 10)))));
SELECT count(*) FROM t2;
count(*)
59
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 9 * 10 - 9), Point(6 * 10, 9 * 10)))));
SELECT count(*) FROM t2;
count(*)
58
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 8 * 10 - 9), Point(6 * 10, 8 * 10)))));
SELECT count(*) FROM t2;
count(*)
57
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 7 * 10 - 9), Point(6 * 10, 7 * 10)))));
SELECT count(*) FROM t2;
count(*)
56
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 6 * 10 - 9), Point(6 * 10, 6 * 10)))));
SELECT count(*) FROM t2;
count(*)
55
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 5 * 10 - 9), Point(6 * 10, 5 * 10)))));
SELECT count(*) FROM t2;
count(*)
54
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 4 * 10 - 9), Point(6 * 10, 4 * 10)))));
SELECT count(*) FROM t2;
count(*)
53
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 3 * 10 - 9), Point(6 * 10, 3 * 10)))));
SELECT count(*) FROM t2;
count(*)
52
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 2 * 10 - 9), Point(6 * 10, 2 * 10)))));
SELECT count(*) FROM t2;
count(*)
51
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 1 * 10 - 9), Point(6 * 10, 1 * 10)))));
SELECT count(*) FROM t2;
count(*)
50
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 10 * 10 - 9), Point(5 * 10, 10 * 10)))));
SELECT count(*) FROM t2;
count(*)
49
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 9 * 10 - 9), Point(5 * 10, 9 * 10)))));
SELECT count(*) FROM t2;
count(*)
48
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 8 * 10 - 9), Point(5 * 10, 8 * 10)))));
SELECT count(*) FROM t2;
count(*)
47
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 7 * 10 - 9), Point(5 * 10, 7 * 10)))));
SELECT count(*) FROM t2;
count(*)
46
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 6 * 10 - 9), Point(5 * 10, 6 * 10)))));
SELECT count(*) FROM t2;
count(*)
45
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 5 * 10 - 9), Point(5 * 10, 5 * 10)))));
SELECT count(*) FROM t2;
count(*)
44
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 4 * 10 - 9), Point(5 * 10, 4 * 10)))));
SELECT count(*) FROM t2;
count(*)
43
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 3 * 10 - 9), Point(5 * 10, 3 * 10)))));
SELECT count(*) FROM t2;
count(*)
42
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 2 * 10 - 9), Point(5 * 10, 2 * 10)))));
SELECT count(*) FROM t2;
count(*)
41
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 1 * 10 - 9), Point(5 * 10, 1 * 10)))));
SELECT count(*) FROM t2;
count(*)
40
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 10 * 10 - 9), Point(4 * 10, 10 * 10)))));
SELECT count(*) FROM t2;
count(*)
39
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 9 * 10 - 9), Point(4 * 10, 9 * 10)))));
SELECT count(*) FROM t2;
count(*)
38
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 8 * 10 - 9), Point(4 * 10, 8 * 10)))));
SELECT count(*) FROM t2;
count(*)
37
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 7 * 10 - 9), Point(4 * 10, 7 * 10)))));
SELECT count(*) FROM t2;
count(*)
36
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 6 * 10 - 9), Point(4 * 10, 6 * 10)))));
SELECT count(*) FROM t2;
count(*)
35
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 5 * 10 - 9), Point(4 * 10, 5 * 10)))));
SELECT count(*) FROM t2;
count(*)
34
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 4 * 10 - 9), Point(4 * 10, 4 * 10)))));
SELECT count(*) FROM t2;
count(*)
33
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 3 * 10 - 9), Point(4 * 10, 3 * 10)))));
SELECT count(*) FROM t2;
count(*)
32
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 2 * 10 - 9), Point(4 * 10, 2 * 10)))));
SELECT count(*) FROM t2;
count(*)
31
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 1 * 10 - 9), Point(4 * 10, 1 * 10)))));
SELECT count(*) FROM t2;
count(*)
30
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 10 * 10 - 9), Point(3 * 10, 10 * 10)))));
SELECT count(*) FROM t2;
count(*)
29
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 9 * 10 - 9), Point(3 * 10, 9 * 10)))));
SELECT count(*) FROM t2;
count(*)
28
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 8 * 10 - 9), Point(3 * 10, 8 * 10)))));
SELECT count(*) FROM t2;
count(*)
27
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 7 * 10 - 9), Point(3 * 10, 7 * 10)))));
SELECT count(*) FROM t2;
count(*)
26
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 6 * 10 - 9), Point(3 * 10, 6 * 10)))));
SELECT count(*) FROM t2;
count(*)
25
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 5 * 10 - 9), Point(3 * 10, 5 * 10)))));
SELECT count(*) FROM t2;
count(*)
24
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 4 * 10 - 9), Point(3 * 10, 4 * 10)))));
SELECT count(*) FROM t2;
count(*)
23
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 3 * 10 - 9), Point(3 * 10, 3 * 10)))));
SELECT count(*) FROM t2;
count(*)
22
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 2 * 10 - 9), Point(3 * 10, 2 * 10)))));
SELECT count(*) FROM t2;
count(*)
21
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 1 * 10 - 9), Point(3 * 10, 1 * 10)))));
SELECT count(*) FROM t2;
count(*)
20
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 10 * 10 - 9), Point(2 * 10, 10 * 10)))));
SELECT count(*) FROM t2;
count(*)
19
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 9 * 10 - 9), Point(2 * 10, 9 * 10)))));
SELECT count(*) FROM t2;
count(*)
18
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 8 * 10 - 9), Point(2 * 10, 8 * 10)))));
SELECT count(*) FROM t2;
count(*)
17
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 7 * 10 - 9), Point(2 * 10, 7 * 10)))));
SELECT count(*) FROM t2;
count(*)
16
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 6 * 10 - 9), Point(2 * 10, 6 * 10)))));
SELECT count(*) FROM t2;
count(*)
15
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 5 * 10 - 9), Point(2 * 10, 5 * 10)))));
SELECT count(*) FROM t2;
count(*)
14
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 4 * 10 - 9), Point(2 * 10, 4 * 10)))));
SELECT count(*) FROM t2;
count(*)
13
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 3 * 10 - 9), Point(2 * 10, 3 * 10)))));
SELECT count(*) FROM t2;
count(*)
12
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 2 * 10 - 9), Point(2 * 10, 2 * 10)))));
SELECT count(*) FROM t2;
count(*)
11
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 1 * 10 - 9), Point(2 * 10, 1 * 10)))));
SELECT count(*) FROM t2;
count(*)
10
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 10 * 10 - 9), Point(1 * 10, 10 * 10)))));
SELECT count(*) FROM t2;
count(*)
9
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 9 * 10 - 9), Point(1 * 10, 9 * 10)))));
SELECT count(*) FROM t2;
count(*)
8
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 8 * 10 - 9), Point(1 * 10, 8 * 10)))));
SELECT count(*) FROM t2;
count(*)
7
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 7 * 10 - 9), Point(1 * 10, 7 * 10)))));
SELECT count(*) FROM t2;
count(*)
6
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 6 * 10 - 9), Point(1 * 10, 6 * 10)))));
SELECT count(*) FROM t2;
count(*)
5
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 5 * 10 - 9), Point(1 * 10, 5 * 10)))));
SELECT count(*) FROM t2;
count(*)
4
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 4 * 10 - 9), Point(1 * 10, 4 * 10)))));
SELECT count(*) FROM t2;
count(*)
3
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 3 * 10 - 9), Point(1 * 10, 3 * 10)))));
SELECT count(*) FROM t2;
count(*)
2
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 2 * 10 - 9), Point(1 * 10, 2 * 10)))));
SELECT count(*) FROM t2;
count(*)
1
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 1 * 10 - 9), Point(1 * 10, 1 * 10)))));
SELECT count(*) FROM t2;
count(*)
0
DROP TABLE t2;
drop table if exists t1;
Warnings:
Note 1051 Unknown table 't1'
CREATE TABLE t1 (a geometry NOT NULL, SPATIAL (a)) transactional=1 row_format=page;
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
drop table t1;
CREATE TABLE t1 (
fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
g GEOMETRY NOT NULL,
SPATIAL KEY(g)
) transactional=1 row_format=page;
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(1 2, 2 3)')),(GeomFromText('LineString(1 2, 2 4)'));
drop table t1;
CREATE TABLE t1 (
line LINESTRING NOT NULL,
kind ENUM('po', 'pp', 'rr', 'dr', 'rd', 'ts', 'cl') NOT NULL DEFAULT 'po',
name VARCHAR(32),
SPATIAL KEY (line)
) transactional=1 row_format=page;
ALTER TABLE t1 DISABLE KEYS;
INSERT INTO t1 (name, kind, line) VALUES
("Aadaouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
("Aadassiye", "pp", GeomFromText("POINT(35.816667 36.216667)")),
("Aadbel", "pp", GeomFromText("POINT(34.533333 36.100000)")),
("Aadchit", "pp", GeomFromText("POINT(33.347222 35.423611)")),
("Aadchite", "pp", GeomFromText("POINT(33.347222 35.423611)")),
("Aadchit el Qoussair", "pp", GeomFromText("POINT(33.283333 35.483333)")),
("Aaddaye", "pp", GeomFromText("POINT(36.716667 40.833333)")),
("'Aadeissa", "pp", GeomFromText("POINT(32.823889 35.698889)")),
("Aaderup", "pp", GeomFromText("POINT(55.216667 11.766667)")),
("Qalaat Aades", "pp", GeomFromText("POINT(33.503333 35.377500)")),
("A ad'ino", "pp", GeomFromText("POINT(54.812222 38.209167)")),
("Aadi Noia", "pp", GeomFromText("POINT(13.800000 39.833333)")),
("Aad La Macta", "pp", GeomFromText("POINT(35.779444 -0.129167)")),
("Aadland", "pp", GeomFromText("POINT(60.366667 5.483333)")),
("Aadliye", "pp", GeomFromText("POINT(33.366667 36.333333)")),
("Aadloun", "pp", GeomFromText("POINT(33.403889 35.273889)")),
("Aadma", "pp", GeomFromText("POINT(58.798333 22.663889)")),
("Aadma Asundus", "pp", GeomFromText("POINT(58.798333 22.663889)")),
("Aadmoun", "pp", GeomFromText("POINT(34.150000 35.650000)")),
("Aadneram", "pp", GeomFromText("POINT(59.016667 6.933333)")),
("Aadneskaar", "pp", GeomFromText("POINT(58.083333 6.983333)")),
("Aadorf", "pp", GeomFromText("POINT(47.483333 8.900000)")),
("Aadorp", "pp", GeomFromText("POINT(52.366667 6.633333)")),
("Aadouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
("Aadoui", "pp", GeomFromText("POINT(34.450000 35.983333)")),
("Aadouiye", "pp", GeomFromText("POINT(34.583333 36.183333)")),
("Aadouss", "pp", GeomFromText("POINT(33.512500 35.601389)")),
("Aadra", "pp", GeomFromText("POINT(33.616667 36.500000)")),
("Aadzi", "pp", GeomFromText("POINT(38.100000 64.850000)"));
ALTER TABLE t1 ENABLE KEYS;
INSERT INTO t1 (name, kind, line) VALUES ("austria", "pp", GeomFromText('LINESTRING(14.9906 48.9887,14.9946 48.9904,14.9947 48.9916)'));
drop table t1;
CREATE TABLE t1 (st varchar(100));
INSERT INTO t1 VALUES ("Fake string");
CREATE TABLE t2 (geom GEOMETRY NOT NULL, SPATIAL KEY gk(geom)) transactional=1 row_format=page;
INSERT INTO t2 SELECT GeomFromText(st) FROM t1;
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1, t2;
CREATE TABLE t1 (`geometry` geometry NOT NULL default '',SPATIAL KEY `gndx` (`geometry`)) transactional=1 row_format=page DEFAULT CHARSET=latin1;
Warnings:
Warning 1101 BLOB/TEXT column 'geometry' can't have a default value
INSERT INTO t1 (geometry) VALUES
(PolygonFromText('POLYGON((-18.6086111000 -66.9327777000, -18.6055555000
-66.8158332999, -18.7186111000 -66.8102777000, -18.7211111000 -66.9269443999,
-18.6086111000 -66.9327777000))'));
INSERT INTO t1 (geometry) VALUES
(PolygonFromText('POLYGON((-65.7402776999 -96.6686111000, -65.7372222000
-96.5516666000, -65.8502777000 -96.5461111000, -65.8527777000 -96.6627777000,
-65.7402776999 -96.6686111000))'));
check table t1 extended;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
CREATE TABLE t1 (
c1 geometry NOT NULL default '',
SPATIAL KEY i1 (c1)
) transactional=1 row_format=page DEFAULT CHARSET=latin1;
Warnings:
Warning 1101 BLOB/TEXT column 'c1' can't have a default value
INSERT INTO t1 (c1) VALUES (
PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
-18.6055555000 -66.8158332999,
-18.7186111000 -66.8102777000,
-18.7211111000 -66.9269443999,
-18.6086111000 -66.9327777000))'));
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
CREATE TABLE t1 (
c1 geometry NOT NULL default '',
SPATIAL KEY i1 (c1)
) transactional=1 row_format=page DEFAULT CHARSET=latin1;
Warnings:
Warning 1101 BLOB/TEXT column 'c1' can't have a default value
INSERT INTO t1 (c1) VALUES (
PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
-18.6055555000 -66.8158332999,
-18.7186111000 -66.8102777000,
-18.7211111000 -66.9269443999,
-18.6086111000 -66.9327777000))'));
INSERT INTO t1 (c1) VALUES (
PolygonFromText('POLYGON((-65.7402776999 -96.6686111000,
-65.7372222000 -96.5516666000,
-65.8502777000 -96.5461111000,
-65.8527777000 -96.6627777000,
-65.7402776999 -96.6686111000))'));
INSERT INTO t1 (c1) VALUES (
PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
-18.6055555000 -66.8158332999,
-18.7186111000 -66.8102777000,
-18.7211111000 -66.9269443999,
-18.6086111000 -66.9327777000))'));
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
CREATE TABLE t1 (foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) ) transactional=1 row_format=page;
INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(1,1)));
INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(1,0)));
INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(0,1)));
INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(0,0)));
SELECT 1 FROM t1 WHERE foo != PointFromWKB(POINT(0,0));
1
1
1
1
DROP TABLE t1;
CREATE TABLE t1 (id bigint(12) unsigned NOT NULL auto_increment,
c2 varchar(15) collate utf8_bin default NULL,
c1 varchar(15) collate utf8_bin default NULL,
c3 varchar(10) collate utf8_bin default NULL,
spatial_point point NOT NULL,
PRIMARY KEY(id),
SPATIAL KEY (spatial_point)
)transactional=1 row_format=page DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
INSERT INTO t1 (c2, c1, c3, spatial_point) VALUES
('y', 's', 'j', GeomFromText('POINT(167 74)')),
('r', 'n', 'd', GeomFromText('POINT(215 118)')),
('g', 'n', 'e', GeomFromText('POINT(203 98)')),
('h', 'd', 'd', GeomFromText('POINT(54 193)')),
('r', 'x', 'y', GeomFromText('POINT(47 69)')),
('t', 'q', 'r', GeomFromText('POINT(109 42)')),
('a', 'z', 'd', GeomFromText('POINT(0 154)')),
('x', 'v', 'o', GeomFromText('POINT(174 131)')),
('b', 'r', 'a', GeomFromText('POINT(114 253)')),
('x', 'z', 'i', GeomFromText('POINT(163 21)')),
('w', 'p', 'i', GeomFromText('POINT(42 102)')),
('g', 'j', 'j', GeomFromText('POINT(170 133)')),
('m', 'g', 'n', GeomFromText('POINT(28 22)')),
('b', 'z', 'h', GeomFromText('POINT(174 28)')),
('q', 'k', 'f', GeomFromText('POINT(233 73)')),
('w', 'w', 'a', GeomFromText('POINT(124 200)')),
('t', 'j', 'w', GeomFromText('POINT(252 101)')),
('d', 'r', 'd', GeomFromText('POINT(98 18)')),
('w', 'o', 'y', GeomFromText('POINT(165 31)')),
('y', 'h', 't', GeomFromText('POINT(14 220)')),
('d', 'p', 'u', GeomFromText('POINT(223 196)')),
('g', 'y', 'g', GeomFromText('POINT(207 96)')),
('x', 'm', 'n', GeomFromText('POINT(214 3)')),
('g', 'v', 'e', GeomFromText('POINT(140 205)')),
('g', 'm', 'm', GeomFromText('POINT(10 236)')),
('i', 'r', 'j', GeomFromText('POINT(137 228)')),
('w', 's', 'p', GeomFromText('POINT(115 6)')),
('o', 'n', 'k', GeomFromText('POINT(158 129)')),
('j', 'h', 'l', GeomFromText('POINT(129 72)')),
('f', 'x', 'l', GeomFromText('POINT(139 207)')),
('u', 'd', 'n', GeomFromText('POINT(125 109)')),
('b', 'a', 'z', GeomFromText('POINT(30 32)')),
('m', 'h', 'o', GeomFromText('POINT(251 251)')),
('f', 'r', 'd', GeomFromText('POINT(243 211)')),
('b', 'd', 'r', GeomFromText('POINT(232 80)')),
('g', 'k', 'v', GeomFromText('POINT(15 100)')),
('i', 'f', 'c', GeomFromText('POINT(109 66)')),
('r', 't', 'j', GeomFromText('POINT(178 6)')),
('y', 'n', 'f', GeomFromText('POINT(233 211)')),
('f', 'y', 'm', GeomFromText('POINT(99 16)')),
('z', 'q', 'l', GeomFromText('POINT(39 49)')),
('j', 'c', 'r', GeomFromText('POINT(75 187)')),
('c', 'y', 'y', GeomFromText('POINT(246 253)')),
('w', 'u', 'd', GeomFromText('POINT(56 190)')),
('n', 'q', 'm', GeomFromText('POINT(73 149)')),
('d', 'y', 'a', GeomFromText('POINT(134 6)')),
('z', 's', 'w', GeomFromText('POINT(216 225)')),
('d', 'u', 'k', GeomFromText('POINT(132 70)')),
('f', 'v', 't', GeomFromText('POINT(187 141)')),
('r', 'r', 'a', GeomFromText('POINT(152 39)')),
('y', 'p', 'o', GeomFromText('POINT(45 27)')),
('p', 'n', 'm', GeomFromText('POINT(228 148)')),
('e', 'g', 'e', GeomFromText('POINT(88 81)')),
('m', 'a', 'h', GeomFromText('POINT(35 29)')),
('m', 'h', 'f', GeomFromText('POINT(30 71)')),
('h', 'k', 'i', GeomFromText('POINT(244 78)')),
('z', 'v', 'd', GeomFromText('POINT(241 38)')),
('q', 'l', 'j', GeomFromText('POINT(13 71)')),
('s', 'p', 'g', GeomFromText('POINT(108 38)')),
('q', 's', 'j', GeomFromText('POINT(92 101)')),
('l', 'h', 'g', GeomFromText('POINT(120 78)')),
('w', 't', 'b', GeomFromText('POINT(193 109)')),
('b', 's', 's', GeomFromText('POINT(223 211)')),
('w', 'w', 'y', GeomFromText('POINT(122 42)')),
('q', 'c', 'c', GeomFromText('POINT(104 102)')),
('w', 'g', 'n', GeomFromText('POINT(213 120)')),
('p', 'q', 'a', GeomFromText('POINT(247 148)')),
('c', 'z', 'e', GeomFromText('POINT(18 106)')),
('z', 'u', 'n', GeomFromText('POINT(70 133)')),
('j', 'n', 'x', GeomFromText('POINT(232 13)')),
('e', 'h', 'f', GeomFromText('POINT(22 135)')),
('w', 'l', 'f', GeomFromText('POINT(9 180)')),
('a', 'v', 'q', GeomFromText('POINT(163 228)')),
('i', 'z', 'o', GeomFromText('POINT(180 100)')),
('e', 'c', 'l', GeomFromText('POINT(182 231)')),
('c', 'k', 'o', GeomFromText('POINT(19 60)')),
('q', 'f', 'p', GeomFromText('POINT(79 95)')),
('m', 'd', 'r', GeomFromText('POINT(3 127)')),
('m', 'e', 't', GeomFromText('POINT(136 154)')),
('w', 'w', 'w', GeomFromText('POINT(102 15)')),
('l', 'n', 'q', GeomFromText('POINT(71 196)')),
('p', 'k', 'c', GeomFromText('POINT(47 139)')),
('j', 'o', 'r', GeomFromText('POINT(177 128)')),
('j', 'q', 'a', GeomFromText('POINT(170 6)')),
('b', 'a', 'o', GeomFromText('POINT(63 211)')),
('g', 's', 'o', GeomFromText('POINT(144 251)')),
('w', 'u', 'w', GeomFromText('POINT(221 214)')),
('g', 'a', 'm', GeomFromText('POINT(14 102)')),
('u', 'q', 'z', GeomFromText('POINT(86 200)')),
('k', 'a', 'm', GeomFromText('POINT(144 222)')),
('j', 'u', 'r', GeomFromText('POINT(216 142)')),
('q', 'k', 'v', GeomFromText('POINT(121 236)')),
('p', 'o', 'r', GeomFromText('POINT(108 102)')),
('b', 'd', 'x', GeomFromText('POINT(127 198)')),
('k', 's', 'a', GeomFromText('POINT(2 150)')),
('f', 'm', 'f', GeomFromText('POINT(160 191)')),
('q', 'y', 'x', GeomFromText('POINT(98 111)')),
('o', 'f', 'm', GeomFromText('POINT(232 218)')),
('c', 'w', 'j', GeomFromText('POINT(156 165)')),
('s', 'q', 'v', GeomFromText('POINT(98 161)'));
SET @@RAND_SEED1=692635050, @@RAND_SEED2=297339954;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
SET @@RAND_SEED1=159925977, @@RAND_SEED2=942570618;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
SET @@RAND_SEED1=328169745, @@RAND_SEED2=410451954;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
SET @@RAND_SEED1=178507359, @@RAND_SEED2=332493072;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
SET @@RAND_SEED1=1034033013, @@RAND_SEED2=558966507;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
UPDATE t1 set spatial_point=GeomFromText('POINT(230 9)') where c1 like 'y%';
UPDATE t1 set spatial_point=GeomFromText('POINT(95 35)') where c1 like 'j%';
UPDATE t1 set spatial_point=GeomFromText('POINT(93 99)') where c1 like 'a%';
UPDATE t1 set spatial_point=GeomFromText('POINT(19 81)') where c1 like 'r%';
UPDATE t1 set spatial_point=GeomFromText('POINT(20 177)') where c1 like 'h%';
UPDATE t1 set spatial_point=GeomFromText('POINT(221 193)') where c1 like 'u%';
UPDATE t1 set spatial_point=GeomFromText('POINT(195 205)') where c1 like 'd%';
UPDATE t1 set spatial_point=GeomFromText('POINT(15 213)') where c1 like 'u%';
UPDATE t1 set spatial_point=GeomFromText('POINT(214 63)') where c1 like 'n%';
UPDATE t1 set spatial_point=GeomFromText('POINT(243 171)') where c1 like 'c%';
UPDATE t1 set spatial_point=GeomFromText('POINT(198 82)') where c1 like 'y%';
INSERT INTO t1 (c2, c1, c3, spatial_point) VALUES
('f', 'y', 'p', GeomFromText('POINT(109 235)')),
('b', 'e', 'v', GeomFromText('POINT(20 48)')),
('i', 'u', 'f', GeomFromText('POINT(15 55)')),
('o', 'r', 'z', GeomFromText('POINT(105 64)')),
('a', 'p', 'a', GeomFromText('POINT(142 236)')),
('g', 'i', 'k', GeomFromText('POINT(10 49)')),
('x', 'z', 'x', GeomFromText('POINT(192 200)')),
('c', 'v', 'r', GeomFromText('POINT(94 168)')),
('y', 'z', 'e', GeomFromText('POINT(141 51)')),
('h', 'm', 'd', GeomFromText('POINT(35 251)')),
('v', 'm', 'q', GeomFromText('POINT(44 90)')),
('j', 'l', 'z', GeomFromText('POINT(67 237)')),
('i', 'v', 'a', GeomFromText('POINT(75 14)')),
('b', 'q', 't', GeomFromText('POINT(153 33)')),
('e', 'm', 'a', GeomFromText('POINT(247 49)')),
('l', 'y', 'g', GeomFromText('POINT(56 203)')),
('v', 'o', 'r', GeomFromText('POINT(90 54)')),
('r', 'n', 'd', GeomFromText('POINT(135 83)')),
('j', 't', 'u', GeomFromText('POINT(174 239)')),
('u', 'n', 'g', GeomFromText('POINT(104 191)')),
('p', 'q', 'y', GeomFromText('POINT(63 171)')),
('o', 'q', 'p', GeomFromText('POINT(192 103)')),
('f', 'x', 'e', GeomFromText('POINT(244 30)')),
('n', 'x', 'c', GeomFromText('POINT(92 103)')),
('r', 'q', 'z', GeomFromText('POINT(166 20)')),
('s', 'a', 'j', GeomFromText('POINT(137 205)')),
('z', 't', 't', GeomFromText('POINT(99 134)')),
('o', 'm', 'j', GeomFromText('POINT(217 3)')),
('n', 'h', 'j', GeomFromText('POINT(211 17)')),
('v', 'v', 'a', GeomFromText('POINT(41 137)')),
('q', 'o', 'j', GeomFromText('POINT(5 92)')),
('z', 'y', 'e', GeomFromText('POINT(175 212)')),
('j', 'z', 'h', GeomFromText('POINT(224 194)')),
('a', 'g', 'm', GeomFromText('POINT(31 119)')),
('p', 'c', 'f', GeomFromText('POINT(17 221)')),
('t', 'h', 'k', GeomFromText('POINT(26 203)')),
('u', 'w', 'p', GeomFromText('POINT(47 185)')),
('z', 'a', 'c', GeomFromText('POINT(61 133)')),
('u', 'k', 'a', GeomFromText('POINT(210 115)')),
('k', 'f', 'h', GeomFromText('POINT(125 113)')),
('t', 'v', 'y', GeomFromText('POINT(12 239)')),
('u', 'v', 'd', GeomFromText('POINT(90 24)')),
('m', 'y', 'w', GeomFromText('POINT(25 243)')),
('d', 'n', 'g', GeomFromText('POINT(122 92)')),
('z', 'm', 'f', GeomFromText('POINT(235 110)')),
('q', 'd', 'f', GeomFromText('POINT(233 217)')),
('a', 'v', 'u', GeomFromText('POINT(69 59)')),
('x', 'k', 'p', GeomFromText('POINT(240 14)')),
('i', 'v', 'r', GeomFromText('POINT(154 42)')),
('w', 'h', 'l', GeomFromText('POINT(178 156)')),
('d', 'h', 'n', GeomFromText('POINT(65 157)')),
('c', 'k', 'z', GeomFromText('POINT(62 33)')),
('e', 'l', 'w', GeomFromText('POINT(162 1)')),
('r', 'f', 'i', GeomFromText('POINT(127 71)')),
('q', 'm', 'c', GeomFromText('POINT(63 118)')),
('c', 'h', 'u', GeomFromText('POINT(205 203)')),
('d', 't', 'p', GeomFromText('POINT(234 87)')),
('s', 'g', 'h', GeomFromText('POINT(149 34)')),
('o', 'b', 'q', GeomFromText('POINT(159 179)')),
('k', 'u', 'f', GeomFromText('POINT(202 254)')),
('u', 'f', 'g', GeomFromText('POINT(70 15)')),
('x', 's', 'b', GeomFromText('POINT(25 181)')),
('s', 'c', 'g', GeomFromText('POINT(252 17)')),
('a', 'c', 'f', GeomFromText('POINT(89 67)')),
('r', 'e', 'q', GeomFromText('POINT(55 54)')),
('f', 'i', 'k', GeomFromText('POINT(178 230)')),
('p', 'e', 'l', GeomFromText('POINT(198 28)')),
('w', 'o', 'd', GeomFromText('POINT(204 189)')),
('c', 'a', 'g', GeomFromText('POINT(230 178)')),
('r', 'o', 'e', GeomFromText('POINT(61 116)')),
('w', 'a', 'a', GeomFromText('POINT(178 237)')),
('v', 'd', 'e', GeomFromText('POINT(70 85)')),
('k', 'c', 'e', GeomFromText('POINT(147 118)')),
('d', 'q', 't', GeomFromText('POINT(218 77)')),
('k', 'g', 'f', GeomFromText('POINT(192 113)')),
('w', 'n', 'e', GeomFromText('POINT(92 124)')),
('r', 'm', 'q', GeomFromText('POINT(130 65)')),
('o', 'r', 'r', GeomFromText('POINT(174 233)')),
('k', 'n', 't', GeomFromText('POINT(175 147)')),
('q', 'm', 'r', GeomFromText('POINT(18 208)')),
('l', 'd', 'i', GeomFromText('POINT(13 104)')),
('w', 'o', 'y', GeomFromText('POINT(207 39)')),
('p', 'u', 'o', GeomFromText('POINT(114 31)')),
('y', 'a', 'p', GeomFromText('POINT(106 59)')),
('a', 'x', 'z', GeomFromText('POINT(17 57)')),
('v', 'h', 'x', GeomFromText('POINT(170 13)')),
('t', 's', 'u', GeomFromText('POINT(84 18)')),
('z', 'z', 'f', GeomFromText('POINT(250 197)')),
('l', 'z', 't', GeomFromText('POINT(59 80)')),
('j', 'g', 's', GeomFromText('POINT(54 26)')),
('g', 'v', 'm', GeomFromText('POINT(89 98)')),
('q', 'v', 'b', GeomFromText('POINT(39 240)')),
('x', 'k', 'v', GeomFromText('POINT(246 207)')),
('k', 'u', 'i', GeomFromText('POINT(105 111)')),
('w', 'z', 's', GeomFromText('POINT(235 8)')),
('d', 'd', 'd', GeomFromText('POINT(105 4)')),
('c', 'z', 'q', GeomFromText('POINT(13 140)')),
('m', 'k', 'i', GeomFromText('POINT(208 120)')),
('g', 'a', 'g', GeomFromText('POINT(9 182)')),
('z', 'j', 'r', GeomFromText('POINT(149 153)')),
('h', 'f', 'g', GeomFromText('POINT(81 236)')),
('m', 'e', 'q', GeomFromText('POINT(209 215)')),
('c', 'h', 'y', GeomFromText('POINT(235 70)')),
('i', 'e', 'g', GeomFromText('POINT(138 26)')),
('m', 't', 'u', GeomFromText('POINT(119 237)')),
('o', 'w', 's', GeomFromText('POINT(193 166)')),
('f', 'm', 'q', GeomFromText('POINT(85 96)')),
('x', 'l', 'x', GeomFromText('POINT(58 115)')),
('x', 'q', 'u', GeomFromText('POINT(108 210)')),
('b', 'h', 'i', GeomFromText('POINT(250 139)')),
('y', 'd', 'x', GeomFromText('POINT(199 135)')),
('w', 'h', 'p', GeomFromText('POINT(247 233)')),
('p', 'z', 't', GeomFromText('POINT(148 249)')),
('q', 'a', 'u', GeomFromText('POINT(174 78)')),
('v', 't', 'm', GeomFromText('POINT(70 228)')),
('t', 'n', 'f', GeomFromText('POINT(123 2)')),
('x', 't', 'b', GeomFromText('POINT(35 50)')),
('r', 'j', 'f', GeomFromText('POINT(200 51)')),
('s', 'q', 'o', GeomFromText('POINT(23 184)')),
('u', 'v', 'z', GeomFromText('POINT(7 113)')),
('v', 'u', 'l', GeomFromText('POINT(145 190)')),
('o', 'k', 'i', GeomFromText('POINT(161 122)')),
('l', 'y', 'e', GeomFromText('POINT(17 232)')),
('t', 'b', 'e', GeomFromText('POINT(120 50)')),
('e', 's', 'u', GeomFromText('POINT(254 1)')),
('d', 'd', 'u', GeomFromText('POINT(167 140)')),
('o', 'b', 'x', GeomFromText('POINT(186 237)')),
('m', 's', 's', GeomFromText('POINT(172 149)')),
('t', 'y', 'a', GeomFromText('POINT(149 85)')),
('x', 't', 'r', GeomFromText('POINT(10 165)')),
('g', 'c', 'e', GeomFromText('POINT(95 165)')),
('e', 'e', 'z', GeomFromText('POINT(98 65)')),
('f', 'v', 'i', GeomFromText('POINT(149 144)')),
('o', 'p', 'm', GeomFromText('POINT(233 67)')),
('t', 'u', 'b', GeomFromText('POINT(109 215)')),
('o', 'o', 'b', GeomFromText('POINT(130 48)')),
('e', 'm', 'h', GeomFromText('POINT(88 189)')),
('e', 'v', 'y', GeomFromText('POINT(55 29)')),
('e', 't', 'm', GeomFromText('POINT(129 55)')),
('p', 'p', 'i', GeomFromText('POINT(126 222)')),
('c', 'i', 'c', GeomFromText('POINT(19 158)')),
('c', 'b', 's', GeomFromText('POINT(13 19)')),
('u', 'y', 'a', GeomFromText('POINT(114 5)')),
('a', 'o', 'f', GeomFromText('POINT(227 232)')),
('t', 'c', 'z', GeomFromText('POINT(63 62)')),
('d', 'o', 'k', GeomFromText('POINT(48 228)')),
('x', 'c', 'e', GeomFromText('POINT(204 2)')),
('e', 'e', 'g', GeomFromText('POINT(125 43)')),
('o', 'r', 'f', GeomFromText('POINT(171 140)'));
UPDATE t1 set spatial_point=GeomFromText('POINT(163 157)') where c1 like 'w%';
UPDATE t1 set spatial_point=GeomFromText('POINT(53 151)') where c1 like 'd%';
UPDATE t1 set spatial_point=GeomFromText('POINT(96 183)') where c1 like 'r%';
UPDATE t1 set spatial_point=GeomFromText('POINT(57 91)') where c1 like 'q%';
UPDATE t1 set spatial_point=GeomFromText('POINT(202 110)') where c1 like 'c%';
UPDATE t1 set spatial_point=GeomFromText('POINT(120 137)') where c1 like 'w%';
UPDATE t1 set spatial_point=GeomFromText('POINT(207 147)') where c1 like 'c%';
UPDATE t1 set spatial_point=GeomFromText('POINT(31 125)') where c1 like 'e%';
UPDATE t1 set spatial_point=GeomFromText('POINT(27 36)') where c1 like 'r%';
INSERT INTO t1 (c2, c1, c3, spatial_point) VALUES
('b', 'c', 'e', GeomFromText('POINT(41 137)')),
('p', 'y', 'k', GeomFromText('POINT(50 22)')),
('s', 'c', 'h', GeomFromText('POINT(208 173)')),
('x', 'u', 'l', GeomFromText('POINT(199 175)')),
('s', 'r', 'h', GeomFromText('POINT(85 192)')),
('j', 'k', 'u', GeomFromText('POINT(18 25)')),
('p', 'w', 'h', GeomFromText('POINT(152 197)')),
('e', 'd', 'c', GeomFromText('POINT(229 3)')),
('o', 'x', 'k', GeomFromText('POINT(187 155)')),
('o', 'b', 'k', GeomFromText('POINT(208 150)')),
('d', 'a', 'j', GeomFromText('POINT(70 87)')),
('f', 'e', 'k', GeomFromText('POINT(156 96)')),
('u', 'y', 'p', GeomFromText('POINT(239 193)')),
('n', 'v', 'p', GeomFromText('POINT(223 98)')),
('z', 'j', 'r', GeomFromText('POINT(87 89)')),
('h', 'x', 'x', GeomFromText('POINT(92 0)')),
('r', 'v', 'r', GeomFromText('POINT(159 139)')),
('v', 'g', 'g', GeomFromText('POINT(16 229)')),
('z', 'k', 'u', GeomFromText('POINT(99 52)')),
('p', 'p', 'o', GeomFromText('POINT(105 125)')),
('w', 'h', 'y', GeomFromText('POINT(105 154)')),
('v', 'y', 'z', GeomFromText('POINT(134 238)')),
('x', 'o', 'o', GeomFromText('POINT(178 88)')),
('z', 'w', 'd', GeomFromText('POINT(123 60)')),
('q', 'f', 'u', GeomFromText('POINT(64 90)')),
('s', 'n', 't', GeomFromText('POINT(50 138)')),
('v', 'p', 't', GeomFromText('POINT(114 91)')),
('a', 'o', 'n', GeomFromText('POINT(78 43)')),
('k', 'u', 'd', GeomFromText('POINT(185 161)')),
('w', 'd', 'n', GeomFromText('POINT(25 92)')),
('k', 'w', 'a', GeomFromText('POINT(59 238)')),
('t', 'c', 'f', GeomFromText('POINT(65 87)')),
('g', 's', 'p', GeomFromText('POINT(238 126)')),
('d', 'n', 'y', GeomFromText('POINT(107 173)')),
('l', 'a', 'w', GeomFromText('POINT(125 152)')),
('m', 'd', 'j', GeomFromText('POINT(146 53)')),
('q', 'm', 'c', GeomFromText('POINT(217 187)')),
('i', 'r', 'r', GeomFromText('POINT(6 113)')),
('e', 'j', 'b', GeomFromText('POINT(37 83)')),
('w', 'w', 'h', GeomFromText('POINT(83 199)')),
('k', 'b', 's', GeomFromText('POINT(170 64)')),
('s', 'b', 'c', GeomFromText('POINT(163 130)')),
('c', 'h', 'a', GeomFromText('POINT(141 3)')),
('k', 'j', 'u', GeomFromText('POINT(143 76)')),
('r', 'h', 'o', GeomFromText('POINT(243 92)')),
('i', 'd', 'b', GeomFromText('POINT(205 13)')),
('r', 'y', 'q', GeomFromText('POINT(138 8)')),
('m', 'o', 'i', GeomFromText('POINT(36 45)')),
('v', 'g', 'm', GeomFromText('POINT(0 40)')),
('f', 'e', 'i', GeomFromText('POINT(76 6)')),
('c', 'q', 'q', GeomFromText('POINT(115 248)')),
('x', 'c', 'i', GeomFromText('POINT(29 74)')),
('l', 's', 't', GeomFromText('POINT(83 18)')),
('t', 't', 'a', GeomFromText('POINT(26 168)')),
('u', 'n', 'x', GeomFromText('POINT(200 110)')),
('j', 'b', 'd', GeomFromText('POINT(216 136)')),
('s', 'p', 'w', GeomFromText('POINT(38 156)')),
('f', 'b', 'v', GeomFromText('POINT(29 186)')),
('v', 'e', 'r', GeomFromText('POINT(149 40)')),
('v', 't', 'm', GeomFromText('POINT(184 24)')),
('y', 'g', 'a', GeomFromText('POINT(219 105)')),
('s', 'f', 'i', GeomFromText('POINT(114 130)')),
('e', 'q', 'h', GeomFromText('POINT(203 135)')),
('h', 'g', 'b', GeomFromText('POINT(9 208)')),
('o', 'l', 'r', GeomFromText('POINT(245 79)')),
('s', 's', 'v', GeomFromText('POINT(238 198)')),
('w', 'w', 'z', GeomFromText('POINT(209 232)')),
('v', 'd', 'n', GeomFromText('POINT(30 193)')),
('q', 'w', 'k', GeomFromText('POINT(133 18)')),
('o', 'h', 'o', GeomFromText('POINT(42 140)')),
('f', 'f', 'h', GeomFromText('POINT(145 1)')),
('u', 's', 'r', GeomFromText('POINT(70 62)')),
('x', 'n', 'q', GeomFromText('POINT(33 86)')),
('u', 'p', 'v', GeomFromText('POINT(232 220)')),
('z', 'e', 'a', GeomFromText('POINT(130 69)')),
('r', 'u', 'z', GeomFromText('POINT(243 241)')),
('b', 'n', 't', GeomFromText('POINT(120 12)')),
('u', 'f', 's', GeomFromText('POINT(190 212)')),
('a', 'd', 'q', GeomFromText('POINT(235 191)')),
('f', 'q', 'm', GeomFromText('POINT(176 2)')),
('n', 'c', 's', GeomFromText('POINT(218 163)')),
('e', 'm', 'h', GeomFromText('POINT(163 108)')),
('c', 'f', 'l', GeomFromText('POINT(220 115)')),
('c', 'v', 'q', GeomFromText('POINT(66 45)')),
('w', 'v', 'x', GeomFromText('POINT(251 220)')),
('f', 'w', 'z', GeomFromText('POINT(146 149)')),
('h', 'n', 'h', GeomFromText('POINT(148 128)')),
('y', 'k', 'v', GeomFromText('POINT(28 110)')),
('c', 'x', 'q', GeomFromText('POINT(13 13)')),
('e', 'd', 's', GeomFromText('POINT(91 190)')),
('c', 'w', 'c', GeomFromText('POINT(10 231)')),
('u', 'j', 'n', GeomFromText('POINT(250 21)')),
('w', 'n', 'x', GeomFromText('POINT(141 69)')),
('f', 'p', 'y', GeomFromText('POINT(228 246)')),
('d', 'q', 'f', GeomFromText('POINT(194 22)')),
('d', 'z', 'l', GeomFromText('POINT(233 181)')),
('c', 'a', 'q', GeomFromText('POINT(183 96)')),
('m', 'i', 'd', GeomFromText('POINT(117 226)')),
('z', 'y', 'y', GeomFromText('POINT(62 81)')),
('g', 'v', 'm', GeomFromText('POINT(66 158)'));
SET @@RAND_SEED1=481064922, @@RAND_SEED2=438133497;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
SET @@RAND_SEED1=280535103, @@RAND_SEED2=444518646;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
SET @@RAND_SEED1=1072017234, @@RAND_SEED2=484203885;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
SET @@RAND_SEED1=358851897, @@RAND_SEED2=358495224;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
SET @@RAND_SEED1=509031459, @@RAND_SEED2=675962925;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
UPDATE t1 set spatial_point=GeomFromText('POINT(61 203)') where c1 like 'y%';
UPDATE t1 set spatial_point=GeomFromText('POINT(202 194)') where c1 like 'f%';
UPDATE t1 set spatial_point=GeomFromText('POINT(228 18)') where c1 like 'h%';
UPDATE t1 set spatial_point=GeomFromText('POINT(88 18)') where c1 like 'l%';
UPDATE t1 set spatial_point=GeomFromText('POINT(176 94)') where c1 like 'e%';
UPDATE t1 set spatial_point=GeomFromText('POINT(44 47)') where c1 like 'g%';
UPDATE t1 set spatial_point=GeomFromText('POINT(95 191)') where c1 like 'b%';
UPDATE t1 set spatial_point=GeomFromText('POINT(179 218)') where c1 like 'y%';
UPDATE t1 set spatial_point=GeomFromText('POINT(239 40)') where c1 like 'g%';
UPDATE t1 set spatial_point=GeomFromText('POINT(248 41)') where c1 like 'q%';
UPDATE t1 set spatial_point=GeomFromText('POINT(167 82)') where c1 like 't%';
UPDATE t1 set spatial_point=GeomFromText('POINT(13 104)') where c1 like 'u%';
UPDATE t1 set spatial_point=GeomFromText('POINT(139 84)') where c1 like 'a%';
UPDATE t1 set spatial_point=GeomFromText('POINT(145 108)') where c1 like 'p%';
UPDATE t1 set spatial_point=GeomFromText('POINT(147 57)') where c1 like 't%';
UPDATE t1 set spatial_point=GeomFromText('POINT(217 144)') where c1 like 'n%';
UPDATE t1 set spatial_point=GeomFromText('POINT(160 224)') where c1 like 'w%';
UPDATE t1 set spatial_point=GeomFromText('POINT(38 28)') where c1 like 'j%';
UPDATE t1 set spatial_point=GeomFromText('POINT(104 114)') where c1 like 'q%';
UPDATE t1 set spatial_point=GeomFromText('POINT(88 19)') where c1 like 'c%';
INSERT INTO t1 (c2, c1, c3, spatial_point) VALUES
('f', 'x', 'p', GeomFromText('POINT(92 181)')),
('s', 'i', 'c', GeomFromText('POINT(49 60)')),
('c', 'c', 'i', GeomFromText('POINT(7 57)')),
('n', 'g', 'k', GeomFromText('POINT(252 105)')),
('g', 'b', 'm', GeomFromText('POINT(180 11)')),
('u', 'l', 'r', GeomFromText('POINT(32 90)')),
('c', 'x', 'e', GeomFromText('POINT(143 24)')),
('x', 'u', 'a', GeomFromText('POINT(123 92)')),
('s', 'b', 'h', GeomFromText('POINT(190 108)')),
('c', 'x', 'b', GeomFromText('POINT(104 100)')),
('i', 'd', 't', GeomFromText('POINT(214 104)')),
('r', 'w', 'g', GeomFromText('POINT(29 67)')),
('b', 'f', 'g', GeomFromText('POINT(149 46)')),
('r', 'r', 'd', GeomFromText('POINT(242 196)')),
('j', 'l', 'a', GeomFromText('POINT(90 196)')),
('e', 't', 'b', GeomFromText('POINT(190 64)')),
('l', 'x', 'w', GeomFromText('POINT(250 73)')),
('q', 'y', 'r', GeomFromText('POINT(120 182)')),
('s', 'j', 'a', GeomFromText('POINT(180 175)')),
('n', 'i', 'y', GeomFromText('POINT(124 136)')),
('s', 'x', 's', GeomFromText('POINT(176 209)')),
('u', 'f', 's', GeomFromText('POINT(215 173)')),
('m', 'j', 'x', GeomFromText('POINT(44 140)')),
('v', 'g', 'x', GeomFromText('POINT(177 233)')),
('u', 't', 'b', GeomFromText('POINT(136 197)')),
('f', 'g', 'b', GeomFromText('POINT(10 8)')),
('v', 'c', 'j', GeomFromText('POINT(13 81)')),
('d', 's', 'q', GeomFromText('POINT(200 100)')),
('a', 'p', 'j', GeomFromText('POINT(33 40)')),
('i', 'c', 'g', GeomFromText('POINT(168 204)')),
('k', 'h', 'i', GeomFromText('POINT(93 243)')),
('s', 'b', 's', GeomFromText('POINT(157 13)')),
('v', 'l', 'l', GeomFromText('POINT(103 6)')),
('r', 'b', 'k', GeomFromText('POINT(244 137)')),
('l', 'd', 'r', GeomFromText('POINT(162 254)')),
('q', 'b', 'z', GeomFromText('POINT(136 246)')),
('x', 'x', 'p', GeomFromText('POINT(120 37)')),
('m', 'e', 'z', GeomFromText('POINT(203 167)')),
('q', 'n', 'p', GeomFromText('POINT(94 119)')),
('b', 'g', 'u', GeomFromText('POINT(93 248)')),
('r', 'v', 'v', GeomFromText('POINT(53 88)')),
('y', 'a', 'i', GeomFromText('POINT(98 219)')),
('a', 's', 'g', GeomFromText('POINT(173 138)')),
('c', 'a', 't', GeomFromText('POINT(235 135)')),
('q', 'm', 'd', GeomFromText('POINT(224 208)')),
('e', 'p', 'k', GeomFromText('POINT(161 238)')),
('n', 'g', 'q', GeomFromText('POINT(35 204)')),
('t', 't', 'x', GeomFromText('POINT(230 178)')),
('w', 'f', 'a', GeomFromText('POINT(150 221)')),
('z', 'm', 'z', GeomFromText('POINT(119 42)')),
('l', 'j', 's', GeomFromText('POINT(97 96)')),
('f', 'z', 'x', GeomFromText('POINT(208 65)')),
('i', 'v', 'c', GeomFromText('POINT(145 79)')),
('l', 'f', 'k', GeomFromText('POINT(83 234)')),
('u', 'a', 's', GeomFromText('POINT(250 49)')),
('o', 'k', 'p', GeomFromText('POINT(46 50)')),
('d', 'e', 'z', GeomFromText('POINT(30 198)')),
('r', 'r', 'l', GeomFromText('POINT(78 189)')),
('y', 'l', 'f', GeomFromText('POINT(188 132)')),
('d', 'q', 'm', GeomFromText('POINT(247 107)')),
('p', 'j', 'n', GeomFromText('POINT(148 227)')),
('b', 'o', 'i', GeomFromText('POINT(172 25)')),
('e', 'v', 'd', GeomFromText('POINT(94 248)')),
('q', 'd', 'f', GeomFromText('POINT(15 29)')),
('w', 'b', 'b', GeomFromText('POINT(74 111)')),
('g', 'q', 'f', GeomFromText('POINT(107 215)')),
('o', 'h', 'r', GeomFromText('POINT(25 168)')),
('u', 't', 'w', GeomFromText('POINT(251 188)')),
('h', 's', 'w', GeomFromText('POINT(254 247)')),
('f', 'f', 'b', GeomFromText('POINT(166 103)'));
SET @@RAND_SEED1=866613816, @@RAND_SEED2=92289615;
INSERT INTO t1 (c2, c1, c3, spatial_point) VALUES
('l', 'c', 'l', GeomFromText('POINT(202 98)')),
('k', 'c', 'b', GeomFromText('POINT(46 206)')),
('r', 'y', 'm', GeomFromText('POINT(74 140)')),
('y', 'z', 'd', GeomFromText('POINT(200 160)')),
('s', 'y', 's', GeomFromText('POINT(156 205)')),
('u', 'v', 'p', GeomFromText('POINT(86 82)')),
('j', 's', 's', GeomFromText('POINT(91 233)')),
('x', 'j', 'f', GeomFromText('POINT(3 14)')),
('l', 'z', 'v', GeomFromText('POINT(123 156)')),
('h', 'i', 'o', GeomFromText('POINT(145 229)')),
('o', 'r', 'd', GeomFromText('POINT(15 22)')),
('f', 'x', 't', GeomFromText('POINT(21 60)')),
('t', 'g', 'h', GeomFromText('POINT(50 153)')),
('g', 'u', 'b', GeomFromText('POINT(82 85)')),
('v', 'a', 'p', GeomFromText('POINT(231 178)')),
('n', 'v', 'o', GeomFromText('POINT(183 25)')),
('j', 'n', 'm', GeomFromText('POINT(50 144)')),
('e', 'f', 'i', GeomFromText('POINT(46 16)')),
('d', 'w', 'a', GeomFromText('POINT(66 6)')),
('f', 'x', 'a', GeomFromText('POINT(107 197)')),
('m', 'o', 'a', GeomFromText('POINT(142 80)')),
('q', 'l', 'g', GeomFromText('POINT(251 23)')),
('c', 's', 's', GeomFromText('POINT(158 43)')),
('y', 'd', 'o', GeomFromText('POINT(196 228)')),
('d', 'p', 'l', GeomFromText('POINT(107 5)')),
('h', 'a', 'b', GeomFromText('POINT(183 166)')),
('m', 'w', 'p', GeomFromText('POINT(19 59)')),
('b', 'y', 'o', GeomFromText('POINT(178 30)')),
('x', 'w', 'i', GeomFromText('POINT(168 94)')),
('t', 'k', 'z', GeomFromText('POINT(171 5)')),
('r', 'm', 'a', GeomFromText('POINT(222 19)')),
('u', 'v', 'e', GeomFromText('POINT(224 80)')),
('q', 'r', 'k', GeomFromText('POINT(212 218)')),
('d', 'p', 'j', GeomFromText('POINT(169 7)')),
('d', 'r', 'v', GeomFromText('POINT(193 23)')),
('n', 'y', 'y', GeomFromText('POINT(130 178)')),
('m', 'z', 'r', GeomFromText('POINT(81 200)')),
('j', 'e', 'w', GeomFromText('POINT(145 239)')),
('v', 'h', 'x', GeomFromText('POINT(24 105)')),
('z', 'm', 'a', GeomFromText('POINT(175 129)')),
('b', 'c', 'v', GeomFromText('POINT(213 10)')),
('t', 't', 'u', GeomFromText('POINT(2 129)')),
('r', 's', 'v', GeomFromText('POINT(209 192)')),
('x', 'p', 'g', GeomFromText('POINT(43 63)')),
('t', 'e', 'u', GeomFromText('POINT(139 210)')),
('l', 'e', 't', GeomFromText('POINT(245 148)')),
('a', 'i', 'k', GeomFromText('POINT(167 195)')),
('m', 'o', 'h', GeomFromText('POINT(206 120)')),
('g', 'z', 's', GeomFromText('POINT(169 240)')),
('z', 'u', 's', GeomFromText('POINT(202 120)')),
('i', 'b', 'a', GeomFromText('POINT(216 18)')),
('w', 'y', 'g', GeomFromText('POINT(119 236)')),
('h', 'y', 'p', GeomFromText('POINT(161 24)'));
UPDATE t1 set spatial_point=GeomFromText('POINT(33 100)') where c1 like 't%';
UPDATE t1 set spatial_point=GeomFromText('POINT(41 46)') where c1 like 'f%';
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
create table t1 (a geometry not null, spatial index(a)) transactional=1 row_format=page;
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 131072)));
insert into t1 values (PointFromWKB(POINT(9.1248812352444e+192, 2.9740338169556e+284)));
insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, -0)));
insert into t1 values (PointFromWKB(POINT(1.49166814624e-154, 2.0880974297595e-53)));
insert into t1 values (PointFromWKB(POINT(4.0917382598702e+149, 1.2024538023802e+111)));
insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 2.9993936277913e-241)));
insert into t1 values (PointFromWKB(POINT(2.5243548967072e-29, 1.2024538023802e+111)));
insert into t1 values (PointFromWKB(POINT(0, 6.9835074892995e-251)));
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 3.1050361846014e+231)));
insert into t1 values (PointFromWKB(POINT(2.8728483499323e-188, 2.4600631144627e+260)));
insert into t1 values (PointFromWKB(POINT(3.0517578125e-05, 2.0349165139404e+236)));
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 1.1818212630766e-125)));
insert into t1 values (PointFromWKB(POINT(2.481040258324e-265, 5.7766220027675e-275)));
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 2.5243548967072e-29)));
insert into t1 values (PointFromWKB(POINT(5.7766220027675e-275, 9.9464647281957e+86)));
insert into t1 values (PointFromWKB(POINT(2.2181357552967e+130, 3.7857669957337e-270)));
insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.6893488147419e+19)));
insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.7537584144024e+255)));
insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 1.8033161362863e-130)));
insert into t1 values (PointFromWKB(POINT(0, 5.8774717541114e-39)));
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 2.2761049594727e-159)));
insert into t1 values (PointFromWKB(POINT(6.243497100632e+144, 3.7857669957337e-270)));
insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 2.6355494858076e-82)));
insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 3.8518598887745e-34)));
insert into t1 values (PointFromWKB(POINT(4.6566128730774e-10, 2.0880974297595e-53)));
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 1.8827498946116e-183)));
insert into t1 values (PointFromWKB(POINT(1.8033161362863e-130, 9.1248812352444e+192)));
insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, 2.2761049594727e-159)));
insert into t1 values (PointFromWKB(POINT(1.94906280228e+289, 1.2338789709327e-178)));
drop table t1;
CREATE TABLE t1(foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) ) transactional=1 row_format=page;
INSERT INTO t1(foo) VALUES (NULL);
ERROR 23000: Column 'foo' cannot be null
INSERT INTO t1() VALUES ();
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
INSERT INTO t1(foo) VALUES ('');
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
DROP TABLE t1;
CREATE TABLE t1 (a INT AUTO_INCREMENT, b POINT NOT NULL, KEY (a), SPATIAL KEY (b)) transactional=1 row_format=page;
INSERT INTO t1 (b) VALUES (GeomFromText('POINT(1 2)'));
INSERT INTO t1 (b) SELECT b FROM t1;
INSERT INTO t1 (b) SELECT b FROM t1;
INSERT INTO t1 (b) SELECT b FROM t1;
INSERT INTO t1 (b) SELECT b FROM t1;
INSERT INTO t1 (b) SELECT b FROM t1;
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
DROP TABLE t1;
CREATE TABLE t1 (a INT, b GEOMETRY NOT NULL, SPATIAL KEY b(b)) transactional=1 row_format=page;
INSERT INTO t1 VALUES (1, GEOMFROMTEXT('LINESTRING(1102218.456 1,2000000 2)'));
INSERT INTO t1 VALUES (2, GEOMFROMTEXT('LINESTRING(1102218.456 1,2000000 2)'));
SELECT COUNT(*) FROM t1 WHERE
MBRINTERSECTS(b, GEOMFROMTEXT('LINESTRING(1 1,1102219 2)') );
COUNT(*)
2
SELECT COUNT(*) FROM t1 IGNORE INDEX (b) WHERE
MBRINTERSECTS(b, GEOMFROMTEXT('LINESTRING(1 1,1102219 2)') );
COUNT(*)
2
DROP TABLE t1;
End of 5.0 tests.
set global maria_log_file_size=4294967295;
drop database if exists mysqltest;
create database mysqltest;
use mysqltest;
* shut down mysqld, removed logs, restarted it
use mysqltest;
CREATE TABLE t1 (
line LINESTRING NOT NULL,
kind ENUM('po', 'pp', 'rr', 'dr', 'rd', 'ts', 'cl') NOT NULL DEFAULT 'po',
name VARCHAR(32)
,SPATIAL key (line)
) transactional=1 row_format=page engine=maria;
SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 1 line 1 line A NULL 32 NULL SPATIAL
CREATE TABLE t2 (a VARCHAR(200), b TEXT, FULLTEXT (a,b)
) transactional=1 row_format=page engine=maria;
SHOW INDEX FROM t2;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t2 1 a 1 a NULL NULL NULL NULL YES FULLTEXT
t2 1 a 2 b NULL NULL NULL NULL YES FULLTEXT
* TEST of REDO: see if recovery can reconstruct if we give it an old table
* copied t2 for feeding_recovery
* copied t1 for feeding_recovery
flush table t2;
* copied t2 for comparison
flush table t1;
* copied t1 for comparison
SET SESSION debug="+d,maria_flush_whole_log,maria_crash";
* crashing mysqld intentionally
set global maria_checkpoint_interval=1;
ERROR HY000: Lost connection to MySQL server during query
* copied t2 back for feeding_recovery
* copied t1 back for feeding_recovery
* recovery happens
check table t2 extended;
Table Op Msg_type Msg_text
mysqltest.t2 check status OK
* testing that checksum after recovery is as expected
Checksum-check
ok
check table t1 extended;
Table Op Msg_type Msg_text
mysqltest.t1 check status OK
* testing that checksum after recovery is as expected
Checksum-check
ok
use mysqltest;
* TEST of INSERT and DELETE's rollback
flush table t2;
* copied t2 for comparison
flush table t1;
* copied t1 for comparison
lock tables t1 write, t2 write;
SET SESSION debug="+d,maria_crash";
* crashing mysqld intentionally
set global maria_checkpoint_interval=1;
ERROR HY000: Lost connection to MySQL server during query
* recovery happens
check table t2 extended;
Table Op Msg_type Msg_text
mysqltest.t2 check status OK
* testing that checksum after recovery is as expected
Checksum-check
ok
check table t1 extended;
Table Op Msg_type Msg_text
mysqltest.t1 check status OK
* testing that checksum after recovery is as expected
Checksum-check
ok
use mysqltest;
flush table t2;
* copied t2 for comparison
flush table t1;
* copied t1 for comparison
lock tables t1 write, t2 write;
SET SESSION debug="+d,maria_flush_whole_page_cache,maria_crash";
* crashing mysqld intentionally
set global maria_checkpoint_interval=1;
ERROR HY000: Lost connection to MySQL server during query
* recovery happens
check table t2 extended;
Table Op Msg_type Msg_text
mysqltest.t2 check status OK
* testing that checksum after recovery is as expected
Checksum-check
ok
check table t1 extended;
Table Op Msg_type Msg_text
mysqltest.t1 check status OK
* testing that checksum after recovery is as expected
Checksum-check
ok
use mysqltest;
flush table t2;
* copied t2 for comparison
flush table t1;
* copied t1 for comparison
lock tables t1 write, t2 write;
SET SESSION debug="+d,maria_flush_states,maria_flush_whole_log,maria_crash";
* crashing mysqld intentionally
set global maria_checkpoint_interval=1;
ERROR HY000: Lost connection to MySQL server during query
* recovery happens
check table t2 extended;
Table Op Msg_type Msg_text
mysqltest.t2 check status OK
* testing that checksum after recovery is as expected
Checksum-check
ok
check table t1 extended;
Table Op Msg_type Msg_text
mysqltest.t1 check status OK
* testing that checksum after recovery is as expected
Checksum-check
ok
use mysqltest;
flush table t2;
* copied t2 for comparison
flush table t1;
* copied t1 for comparison
lock tables t1 write, t2 write;
SET SESSION debug="+d,maria_flush_whole_log,maria_crash";
* crashing mysqld intentionally
set global maria_checkpoint_interval=1;
ERROR HY000: Lost connection to MySQL server during query
* recovery happens
check table t2 extended;
Table Op Msg_type Msg_text
mysqltest.t2 check status OK
* testing that checksum after recovery is as expected
Checksum-check
ok
check table t1 extended;
Table Op Msg_type Msg_text
mysqltest.t1 check status OK
* testing that checksum after recovery is as expected
Checksum-check
ok
use mysqltest;
flush table t2;
* copied t2 for comparison
flush table t1;
* copied t1 for comparison
lock tables t1 write, t2 write;
select count(*) from t1;
count(*)
1080
delete from t1;
select count(*) from t1;
count(*)
782
select count(*) from t2;
count(*)
720
delete from t2;
select count(*) from t2;
count(*)
0
SET SESSION debug="+d,maria_flush_whole_log,maria_crash";
* crashing mysqld intentionally
set global maria_checkpoint_interval=1;
ERROR HY000: Lost connection to MySQL server during query
* recovery happens
check table t2 extended;
Table Op Msg_type Msg_text
mysqltest.t2 check status OK
* testing that checksum after recovery is as expected
Checksum-check
ok
check table t1 extended;
Table Op Msg_type Msg_text
mysqltest.t1 check status OK
* testing that checksum after recovery is as expected
Checksum-check
ok
use mysqltest;
drop table t1,t2;
......@@ -2195,13 +2195,6 @@ t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MARIA DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
drop table t1;
create table t1 (s varchar(25), fulltext(s)) TRANSACTIONAL= 1;
ERROR HY000: Maria can't yet handle SPATIAL or FULLTEXT keys in transactional mode. For now use TRANSACTIONAL=0
drop table if exists t1;
create table t1 ( fid int not null auto_increment primary key,
g geometry not null, spatial key(g));
ERROR HY000: Maria can't yet handle SPATIAL or FULLTEXT keys in transactional mode. For now use TRANSACTIONAL=0
drop table if exists t1;
set global maria_log_file_size=4294967296;
Warnings:
Warning 1292 Truncated incorrect log_file_size value: '4294967296'
......
-- source include/have_maria.inc
-- source include/have_geometry.inc
set storage_engine=maria;
#
# test of rtree (using with spatial data)
#
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
--enable_warnings
CREATE TABLE t1 (
fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
g GEOMETRY NOT NULL,
SPATIAL KEY(g)
) row_format=dynamic;
SHOW CREATE TABLE t1;
let $1=150;
let $2=150;
while ($1)
{
eval INSERT INTO t1 (g) VALUES (GeomFromText('LineString($1 $1, $2 $2)'));
dec $1;
inc $2;
}
SELECT count(*) FROM t1;
EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
DROP TABLE t1;
CREATE TABLE t2 (
fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
g GEOMETRY NOT NULL
) row_format=dynamic;
let $1=10;
while ($1)
{
let $2=10;
while ($2)
{
eval INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point($1 * 10 - 9, $2 * 10 - 9), Point($1 * 10, $2 * 10))));
dec $2;
}
dec $1;
}
ALTER TABLE t2 ADD SPATIAL KEY(g);
SHOW CREATE TABLE t2;
SELECT count(*) FROM t2;
EXPLAIN SELECT fid, AsText(g) FROM t2 WHERE Within(g,
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
SELECT fid, AsText(g) FROM t2 WHERE Within(g,
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
let $1=10;
while ($1)
{
let $2=10;
while ($2)
{
eval DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point($1 * 10 - 9, $2 * 10 - 9), Point($1 * 10, $2 * 10)))));
SELECT count(*) FROM t2;
dec $2;
}
dec $1;
}
DROP TABLE t2;
drop table if exists t1;
CREATE TABLE t1 (a geometry NOT NULL, SPATIAL (a)) row_format=dynamic;
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
check table t1;
analyze table t1;
drop table t1;
#
# The following crashed gis
#
CREATE TABLE t1 (
fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
g GEOMETRY NOT NULL,
SPATIAL KEY(g)
) row_format=dynamic;
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(1 2, 2 3)')),(GeomFromText('LineString(1 2, 2 4)'));
#select * from t1 where g<GeomFromText('LineString(1 2, 2 3)');
drop table t1;
CREATE TABLE t1 (
line LINESTRING NOT NULL,
kind ENUM('po', 'pp', 'rr', 'dr', 'rd', 'ts', 'cl') NOT NULL DEFAULT 'po',
name VARCHAR(32),
SPATIAL KEY (line)
) row_format=dynamic;
ALTER TABLE t1 DISABLE KEYS;
INSERT INTO t1 (name, kind, line) VALUES
("Aadaouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
("Aadassiye", "pp", GeomFromText("POINT(35.816667 36.216667)")),
("Aadbel", "pp", GeomFromText("POINT(34.533333 36.100000)")),
("Aadchit", "pp", GeomFromText("POINT(33.347222 35.423611)")),
("Aadchite", "pp", GeomFromText("POINT(33.347222 35.423611)")),
("Aadchit el Qoussair", "pp", GeomFromText("POINT(33.283333 35.483333)")),
("Aaddaye", "pp", GeomFromText("POINT(36.716667 40.833333)")),
("'Aadeissa", "pp", GeomFromText("POINT(32.823889 35.698889)")),
("Aaderup", "pp", GeomFromText("POINT(55.216667 11.766667)")),
("Qalaat Aades", "pp", GeomFromText("POINT(33.503333 35.377500)")),
("A ad'ino", "pp", GeomFromText("POINT(54.812222 38.209167)")),
("Aadi Noia", "pp", GeomFromText("POINT(13.800000 39.833333)")),
("Aad La Macta", "pp", GeomFromText("POINT(35.779444 -0.129167)")),
("Aadland", "pp", GeomFromText("POINT(60.366667 5.483333)")),
("Aadliye", "pp", GeomFromText("POINT(33.366667 36.333333)")),
("Aadloun", "pp", GeomFromText("POINT(33.403889 35.273889)")),
("Aadma", "pp", GeomFromText("POINT(58.798333 22.663889)")),
("Aadma Asundus", "pp", GeomFromText("POINT(58.798333 22.663889)")),
("Aadmoun", "pp", GeomFromText("POINT(34.150000 35.650000)")),
("Aadneram", "pp", GeomFromText("POINT(59.016667 6.933333)")),
("Aadneskaar", "pp", GeomFromText("POINT(58.083333 6.983333)")),
("Aadorf", "pp", GeomFromText("POINT(47.483333 8.900000)")),
("Aadorp", "pp", GeomFromText("POINT(52.366667 6.633333)")),
("Aadouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
("Aadoui", "pp", GeomFromText("POINT(34.450000 35.983333)")),
("Aadouiye", "pp", GeomFromText("POINT(34.583333 36.183333)")),
("Aadouss", "pp", GeomFromText("POINT(33.512500 35.601389)")),
("Aadra", "pp", GeomFromText("POINT(33.616667 36.500000)")),
("Aadzi", "pp", GeomFromText("POINT(38.100000 64.850000)"));
ALTER TABLE t1 ENABLE KEYS;
INSERT INTO t1 (name, kind, line) VALUES ("austria", "pp", GeomFromText('LINESTRING(14.9906 48.9887,14.9946 48.9904,14.9947 48.9916)'));
drop table t1;
CREATE TABLE t1 (st varchar(100));
INSERT INTO t1 VALUES ("Fake string");
CREATE TABLE t2 (geom GEOMETRY NOT NULL, SPATIAL KEY gk(geom)) row_format=dynamic;
--error 1416
INSERT INTO t2 SELECT GeomFromText(st) FROM t1;
drop table t1, t2;
CREATE TABLE t1 (`geometry` geometry NOT NULL default '',SPATIAL KEY `gndx` (`geometry`)) row_format=dynamic DEFAULT CHARSET=latin1;
INSERT INTO t1 (geometry) VALUES
(PolygonFromText('POLYGON((-18.6086111000 -66.9327777000, -18.6055555000
-66.8158332999, -18.7186111000 -66.8102777000, -18.7211111000 -66.9269443999,
-18.6086111000 -66.9327777000))'));
INSERT INTO t1 (geometry) VALUES
(PolygonFromText('POLYGON((-65.7402776999 -96.6686111000, -65.7372222000
-96.5516666000, -65.8502777000 -96.5461111000, -65.8527777000 -96.6627777000,
-65.7402776999 -96.6686111000))'));
check table t1 extended;
drop table t1;
#
# Bug#17877 - Corrupted spatial index
#
CREATE TABLE t1 (
c1 geometry NOT NULL default '',
SPATIAL KEY i1 (c1)
) row_format=dynamic DEFAULT CHARSET=latin1;
INSERT INTO t1 (c1) VALUES (
PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
-18.6055555000 -66.8158332999,
-18.7186111000 -66.8102777000,
-18.7211111000 -66.9269443999,
-18.6086111000 -66.9327777000))'));
# This showed a missing key.
CHECK TABLE t1 EXTENDED;
DROP TABLE t1;
#
CREATE TABLE t1 (
c1 geometry NOT NULL default '',
SPATIAL KEY i1 (c1)
) row_format=dynamic DEFAULT CHARSET=latin1;
INSERT INTO t1 (c1) VALUES (
PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
-18.6055555000 -66.8158332999,
-18.7186111000 -66.8102777000,
-18.7211111000 -66.9269443999,
-18.6086111000 -66.9327777000))'));
INSERT INTO t1 (c1) VALUES (
PolygonFromText('POLYGON((-65.7402776999 -96.6686111000,
-65.7372222000 -96.5516666000,
-65.8502777000 -96.5461111000,
-65.8527777000 -96.6627777000,
-65.7402776999 -96.6686111000))'));
# This is the same as the first insert to get a non-unique key.
INSERT INTO t1 (c1) VALUES (
PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
-18.6055555000 -66.8158332999,
-18.7186111000 -66.8102777000,
-18.7211111000 -66.9269443999,
-18.6086111000 -66.9327777000))'));
# This showed (and still shows) OK.
CHECK TABLE t1 EXTENDED;
DROP TABLE t1;
#
# Bug #21888: Query on GEOMETRY field using PointFromWKB() results in lost connection
#
CREATE TABLE t1 (foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) ) row_format=dynamic;
INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(1,1)));
INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(1,0)));
INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(0,1)));
INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(0,0)));
SELECT 1 FROM t1 WHERE foo != PointFromWKB(POINT(0,0));
DROP TABLE t1;
#
# Bug#25673 - spatial index corruption, error 126 incorrect key file for table
#
CREATE TABLE t1 (id bigint(12) unsigned NOT NULL auto_increment,
c2 varchar(15) collate utf8_bin default NULL,
c1 varchar(15) collate utf8_bin default NULL,
c3 varchar(10) collate utf8_bin default NULL,
spatial_point point NOT NULL,
PRIMARY KEY(id),
SPATIAL KEY (spatial_point)
)row_format=dynamic DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
#
INSERT INTO t1 (c2, c1, c3, spatial_point) VALUES
('y', 's', 'j', GeomFromText('POINT(167 74)')),
('r', 'n', 'd', GeomFromText('POINT(215 118)')),
('g', 'n', 'e', GeomFromText('POINT(203 98)')),
('h', 'd', 'd', GeomFromText('POINT(54 193)')),
('r', 'x', 'y', GeomFromText('POINT(47 69)')),
('t', 'q', 'r', GeomFromText('POINT(109 42)')),
('a', 'z', 'd', GeomFromText('POINT(0 154)')),
('x', 'v', 'o', GeomFromText('POINT(174 131)')),
('b', 'r', 'a', GeomFromText('POINT(114 253)')),
('x', 'z', 'i', GeomFromText('POINT(163 21)')),
('w', 'p', 'i', GeomFromText('POINT(42 102)')),
('g', 'j', 'j', GeomFromText('POINT(170 133)')),
('m', 'g', 'n', GeomFromText('POINT(28 22)')),
('b', 'z', 'h', GeomFromText('POINT(174 28)')),
('q', 'k', 'f', GeomFromText('POINT(233 73)')),
('w', 'w', 'a', GeomFromText('POINT(124 200)')),
('t', 'j', 'w', GeomFromText('POINT(252 101)')),
('d', 'r', 'd', GeomFromText('POINT(98 18)')),
('w', 'o', 'y', GeomFromText('POINT(165 31)')),
('y', 'h', 't', GeomFromText('POINT(14 220)')),
('d', 'p', 'u', GeomFromText('POINT(223 196)')),
('g', 'y', 'g', GeomFromText('POINT(207 96)')),
('x', 'm', 'n', GeomFromText('POINT(214 3)')),
('g', 'v', 'e', GeomFromText('POINT(140 205)')),
('g', 'm', 'm', GeomFromText('POINT(10 236)')),
('i', 'r', 'j', GeomFromText('POINT(137 228)')),
('w', 's', 'p', GeomFromText('POINT(115 6)')),
('o', 'n', 'k', GeomFromText('POINT(158 129)')),
('j', 'h', 'l', GeomFromText('POINT(129 72)')),
('f', 'x', 'l', GeomFromText('POINT(139 207)')),
('u', 'd', 'n', GeomFromText('POINT(125 109)')),
('b', 'a', 'z', GeomFromText('POINT(30 32)')),
('m', 'h', 'o', GeomFromText('POINT(251 251)')),
('f', 'r', 'd', GeomFromText('POINT(243 211)')),
('b', 'd', 'r', GeomFromText('POINT(232 80)')),
('g', 'k', 'v', GeomFromText('POINT(15 100)')),
('i', 'f', 'c', GeomFromText('POINT(109 66)')),
('r', 't', 'j', GeomFromText('POINT(178 6)')),
('y', 'n', 'f', GeomFromText('POINT(233 211)')),
('f', 'y', 'm', GeomFromText('POINT(99 16)')),
('z', 'q', 'l', GeomFromText('POINT(39 49)')),
('j', 'c', 'r', GeomFromText('POINT(75 187)')),
('c', 'y', 'y', GeomFromText('POINT(246 253)')),
('w', 'u', 'd', GeomFromText('POINT(56 190)')),
('n', 'q', 'm', GeomFromText('POINT(73 149)')),
('d', 'y', 'a', GeomFromText('POINT(134 6)')),
('z', 's', 'w', GeomFromText('POINT(216 225)')),
('d', 'u', 'k', GeomFromText('POINT(132 70)')),
('f', 'v', 't', GeomFromText('POINT(187 141)')),
('r', 'r', 'a', GeomFromText('POINT(152 39)')),
('y', 'p', 'o', GeomFromText('POINT(45 27)')),
('p', 'n', 'm', GeomFromText('POINT(228 148)')),
('e', 'g', 'e', GeomFromText('POINT(88 81)')),
('m', 'a', 'h', GeomFromText('POINT(35 29)')),
('m', 'h', 'f', GeomFromText('POINT(30 71)')),
('h', 'k', 'i', GeomFromText('POINT(244 78)')),
('z', 'v', 'd', GeomFromText('POINT(241 38)')),
('q', 'l', 'j', GeomFromText('POINT(13 71)')),
('s', 'p', 'g', GeomFromText('POINT(108 38)')),
('q', 's', 'j', GeomFromText('POINT(92 101)')),
('l', 'h', 'g', GeomFromText('POINT(120 78)')),
('w', 't', 'b', GeomFromText('POINT(193 109)')),
('b', 's', 's', GeomFromText('POINT(223 211)')),
('w', 'w', 'y', GeomFromText('POINT(122 42)')),
('q', 'c', 'c', GeomFromText('POINT(104 102)')),
('w', 'g', 'n', GeomFromText('POINT(213 120)')),
('p', 'q', 'a', GeomFromText('POINT(247 148)')),
('c', 'z', 'e', GeomFromText('POINT(18 106)')),
('z', 'u', 'n', GeomFromText('POINT(70 133)')),
('j', 'n', 'x', GeomFromText('POINT(232 13)')),
('e', 'h', 'f', GeomFromText('POINT(22 135)')),
('w', 'l', 'f', GeomFromText('POINT(9 180)')),
('a', 'v', 'q', GeomFromText('POINT(163 228)')),
('i', 'z', 'o', GeomFromText('POINT(180 100)')),
('e', 'c', 'l', GeomFromText('POINT(182 231)')),
('c', 'k', 'o', GeomFromText('POINT(19 60)')),
('q', 'f', 'p', GeomFromText('POINT(79 95)')),
('m', 'd', 'r', GeomFromText('POINT(3 127)')),
('m', 'e', 't', GeomFromText('POINT(136 154)')),
('w', 'w', 'w', GeomFromText('POINT(102 15)')),
('l', 'n', 'q', GeomFromText('POINT(71 196)')),
('p', 'k', 'c', GeomFromText('POINT(47 139)')),
('j', 'o', 'r', GeomFromText('POINT(177 128)')),
('j', 'q', 'a', GeomFromText('POINT(170 6)')),
('b', 'a', 'o', GeomFromText('POINT(63 211)')),
('g', 's', 'o', GeomFromText('POINT(144 251)')),
('w', 'u', 'w', GeomFromText('POINT(221 214)')),
('g', 'a', 'm', GeomFromText('POINT(14 102)')),
('u', 'q', 'z', GeomFromText('POINT(86 200)')),
('k', 'a', 'm', GeomFromText('POINT(144 222)')),
('j', 'u', 'r', GeomFromText('POINT(216 142)')),
('q', 'k', 'v', GeomFromText('POINT(121 236)')),
('p', 'o', 'r', GeomFromText('POINT(108 102)')),
('b', 'd', 'x', GeomFromText('POINT(127 198)')),
('k', 's', 'a', GeomFromText('POINT(2 150)')),
('f', 'm', 'f', GeomFromText('POINT(160 191)')),
('q', 'y', 'x', GeomFromText('POINT(98 111)')),
('o', 'f', 'm', GeomFromText('POINT(232 218)')),
('c', 'w', 'j', GeomFromText('POINT(156 165)')),
('s', 'q', 'v', GeomFromText('POINT(98 161)'));
SET @@RAND_SEED1=692635050, @@RAND_SEED2=297339954;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
SET @@RAND_SEED1=159925977, @@RAND_SEED2=942570618;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
SET @@RAND_SEED1=328169745, @@RAND_SEED2=410451954;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
SET @@RAND_SEED1=178507359, @@RAND_SEED2=332493072;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
SET @@RAND_SEED1=1034033013, @@RAND_SEED2=558966507;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
UPDATE t1 set spatial_point=GeomFromText('POINT(230 9)') where c1 like 'y%';
UPDATE t1 set spatial_point=GeomFromText('POINT(95 35)') where c1 like 'j%';
UPDATE t1 set spatial_point=GeomFromText('POINT(93 99)') where c1 like 'a%';
UPDATE t1 set spatial_point=GeomFromText('POINT(19 81)') where c1 like 'r%';
UPDATE t1 set spatial_point=GeomFromText('POINT(20 177)') where c1 like 'h%';
UPDATE t1 set spatial_point=GeomFromText('POINT(221 193)') where c1 like 'u%';
UPDATE t1 set spatial_point=GeomFromText('POINT(195 205)') where c1 like 'd%';
UPDATE t1 set spatial_point=GeomFromText('POINT(15 213)') where c1 like 'u%';
UPDATE t1 set spatial_point=GeomFromText('POINT(214 63)') where c1 like 'n%';
UPDATE t1 set spatial_point=GeomFromText('POINT(243 171)') where c1 like 'c%';
UPDATE t1 set spatial_point=GeomFromText('POINT(198 82)') where c1 like 'y%';
INSERT INTO t1 (c2, c1, c3, spatial_point) VALUES
('f', 'y', 'p', GeomFromText('POINT(109 235)')),
('b', 'e', 'v', GeomFromText('POINT(20 48)')),
('i', 'u', 'f', GeomFromText('POINT(15 55)')),
('o', 'r', 'z', GeomFromText('POINT(105 64)')),
('a', 'p', 'a', GeomFromText('POINT(142 236)')),
('g', 'i', 'k', GeomFromText('POINT(10 49)')),
('x', 'z', 'x', GeomFromText('POINT(192 200)')),
('c', 'v', 'r', GeomFromText('POINT(94 168)')),
('y', 'z', 'e', GeomFromText('POINT(141 51)')),
('h', 'm', 'd', GeomFromText('POINT(35 251)')),
('v', 'm', 'q', GeomFromText('POINT(44 90)')),
('j', 'l', 'z', GeomFromText('POINT(67 237)')),
('i', 'v', 'a', GeomFromText('POINT(75 14)')),
('b', 'q', 't', GeomFromText('POINT(153 33)')),
('e', 'm', 'a', GeomFromText('POINT(247 49)')),
('l', 'y', 'g', GeomFromText('POINT(56 203)')),
('v', 'o', 'r', GeomFromText('POINT(90 54)')),
('r', 'n', 'd', GeomFromText('POINT(135 83)')),
('j', 't', 'u', GeomFromText('POINT(174 239)')),
('u', 'n', 'g', GeomFromText('POINT(104 191)')),
('p', 'q', 'y', GeomFromText('POINT(63 171)')),
('o', 'q', 'p', GeomFromText('POINT(192 103)')),
('f', 'x', 'e', GeomFromText('POINT(244 30)')),
('n', 'x', 'c', GeomFromText('POINT(92 103)')),
('r', 'q', 'z', GeomFromText('POINT(166 20)')),
('s', 'a', 'j', GeomFromText('POINT(137 205)')),
('z', 't', 't', GeomFromText('POINT(99 134)')),
('o', 'm', 'j', GeomFromText('POINT(217 3)')),
('n', 'h', 'j', GeomFromText('POINT(211 17)')),
('v', 'v', 'a', GeomFromText('POINT(41 137)')),
('q', 'o', 'j', GeomFromText('POINT(5 92)')),
('z', 'y', 'e', GeomFromText('POINT(175 212)')),
('j', 'z', 'h', GeomFromText('POINT(224 194)')),
('a', 'g', 'm', GeomFromText('POINT(31 119)')),
('p', 'c', 'f', GeomFromText('POINT(17 221)')),
('t', 'h', 'k', GeomFromText('POINT(26 203)')),
('u', 'w', 'p', GeomFromText('POINT(47 185)')),
('z', 'a', 'c', GeomFromText('POINT(61 133)')),
('u', 'k', 'a', GeomFromText('POINT(210 115)')),
('k', 'f', 'h', GeomFromText('POINT(125 113)')),
('t', 'v', 'y', GeomFromText('POINT(12 239)')),
('u', 'v', 'd', GeomFromText('POINT(90 24)')),
('m', 'y', 'w', GeomFromText('POINT(25 243)')),
('d', 'n', 'g', GeomFromText('POINT(122 92)')),
('z', 'm', 'f', GeomFromText('POINT(235 110)')),
('q', 'd', 'f', GeomFromText('POINT(233 217)')),
('a', 'v', 'u', GeomFromText('POINT(69 59)')),
('x', 'k', 'p', GeomFromText('POINT(240 14)')),
('i', 'v', 'r', GeomFromText('POINT(154 42)')),
('w', 'h', 'l', GeomFromText('POINT(178 156)')),
('d', 'h', 'n', GeomFromText('POINT(65 157)')),
('c', 'k', 'z', GeomFromText('POINT(62 33)')),
('e', 'l', 'w', GeomFromText('POINT(162 1)')),
('r', 'f', 'i', GeomFromText('POINT(127 71)')),
('q', 'm', 'c', GeomFromText('POINT(63 118)')),
('c', 'h', 'u', GeomFromText('POINT(205 203)')),
('d', 't', 'p', GeomFromText('POINT(234 87)')),
('s', 'g', 'h', GeomFromText('POINT(149 34)')),
('o', 'b', 'q', GeomFromText('POINT(159 179)')),
('k', 'u', 'f', GeomFromText('POINT(202 254)')),
('u', 'f', 'g', GeomFromText('POINT(70 15)')),
('x', 's', 'b', GeomFromText('POINT(25 181)')),
('s', 'c', 'g', GeomFromText('POINT(252 17)')),
('a', 'c', 'f', GeomFromText('POINT(89 67)')),
('r', 'e', 'q', GeomFromText('POINT(55 54)')),
('f', 'i', 'k', GeomFromText('POINT(178 230)')),
('p', 'e', 'l', GeomFromText('POINT(198 28)')),
('w', 'o', 'd', GeomFromText('POINT(204 189)')),
('c', 'a', 'g', GeomFromText('POINT(230 178)')),
('r', 'o', 'e', GeomFromText('POINT(61 116)')),
('w', 'a', 'a', GeomFromText('POINT(178 237)')),
('v', 'd', 'e', GeomFromText('POINT(70 85)')),
('k', 'c', 'e', GeomFromText('POINT(147 118)')),
('d', 'q', 't', GeomFromText('POINT(218 77)')),
('k', 'g', 'f', GeomFromText('POINT(192 113)')),
('w', 'n', 'e', GeomFromText('POINT(92 124)')),
('r', 'm', 'q', GeomFromText('POINT(130 65)')),
('o', 'r', 'r', GeomFromText('POINT(174 233)')),
('k', 'n', 't', GeomFromText('POINT(175 147)')),
('q', 'm', 'r', GeomFromText('POINT(18 208)')),
('l', 'd', 'i', GeomFromText('POINT(13 104)')),
('w', 'o', 'y', GeomFromText('POINT(207 39)')),
('p', 'u', 'o', GeomFromText('POINT(114 31)')),
('y', 'a', 'p', GeomFromText('POINT(106 59)')),
('a', 'x', 'z', GeomFromText('POINT(17 57)')),
('v', 'h', 'x', GeomFromText('POINT(170 13)')),
('t', 's', 'u', GeomFromText('POINT(84 18)')),
('z', 'z', 'f', GeomFromText('POINT(250 197)')),
('l', 'z', 't', GeomFromText('POINT(59 80)')),
('j', 'g', 's', GeomFromText('POINT(54 26)')),
('g', 'v', 'm', GeomFromText('POINT(89 98)')),
('q', 'v', 'b', GeomFromText('POINT(39 240)')),
('x', 'k', 'v', GeomFromText('POINT(246 207)')),
('k', 'u', 'i', GeomFromText('POINT(105 111)')),
('w', 'z', 's', GeomFromText('POINT(235 8)')),
('d', 'd', 'd', GeomFromText('POINT(105 4)')),
('c', 'z', 'q', GeomFromText('POINT(13 140)')),
('m', 'k', 'i', GeomFromText('POINT(208 120)')),
('g', 'a', 'g', GeomFromText('POINT(9 182)')),
('z', 'j', 'r', GeomFromText('POINT(149 153)')),
('h', 'f', 'g', GeomFromText('POINT(81 236)')),
('m', 'e', 'q', GeomFromText('POINT(209 215)')),
('c', 'h', 'y', GeomFromText('POINT(235 70)')),
('i', 'e', 'g', GeomFromText('POINT(138 26)')),
('m', 't', 'u', GeomFromText('POINT(119 237)')),
('o', 'w', 's', GeomFromText('POINT(193 166)')),
('f', 'm', 'q', GeomFromText('POINT(85 96)')),
('x', 'l', 'x', GeomFromText('POINT(58 115)')),
('x', 'q', 'u', GeomFromText('POINT(108 210)')),
('b', 'h', 'i', GeomFromText('POINT(250 139)')),
('y', 'd', 'x', GeomFromText('POINT(199 135)')),
('w', 'h', 'p', GeomFromText('POINT(247 233)')),
('p', 'z', 't', GeomFromText('POINT(148 249)')),
('q', 'a', 'u', GeomFromText('POINT(174 78)')),
('v', 't', 'm', GeomFromText('POINT(70 228)')),
('t', 'n', 'f', GeomFromText('POINT(123 2)')),
('x', 't', 'b', GeomFromText('POINT(35 50)')),
('r', 'j', 'f', GeomFromText('POINT(200 51)')),
('s', 'q', 'o', GeomFromText('POINT(23 184)')),
('u', 'v', 'z', GeomFromText('POINT(7 113)')),
('v', 'u', 'l', GeomFromText('POINT(145 190)')),
('o', 'k', 'i', GeomFromText('POINT(161 122)')),
('l', 'y', 'e', GeomFromText('POINT(17 232)')),
('t', 'b', 'e', GeomFromText('POINT(120 50)')),
('e', 's', 'u', GeomFromText('POINT(254 1)')),
('d', 'd', 'u', GeomFromText('POINT(167 140)')),
('o', 'b', 'x', GeomFromText('POINT(186 237)')),
('m', 's', 's', GeomFromText('POINT(172 149)')),
('t', 'y', 'a', GeomFromText('POINT(149 85)')),
('x', 't', 'r', GeomFromText('POINT(10 165)')),
('g', 'c', 'e', GeomFromText('POINT(95 165)')),
('e', 'e', 'z', GeomFromText('POINT(98 65)')),
('f', 'v', 'i', GeomFromText('POINT(149 144)')),
('o', 'p', 'm', GeomFromText('POINT(233 67)')),
('t', 'u', 'b', GeomFromText('POINT(109 215)')),
('o', 'o', 'b', GeomFromText('POINT(130 48)')),
('e', 'm', 'h', GeomFromText('POINT(88 189)')),
('e', 'v', 'y', GeomFromText('POINT(55 29)')),
('e', 't', 'm', GeomFromText('POINT(129 55)')),
('p', 'p', 'i', GeomFromText('POINT(126 222)')),
('c', 'i', 'c', GeomFromText('POINT(19 158)')),
('c', 'b', 's', GeomFromText('POINT(13 19)')),
('u', 'y', 'a', GeomFromText('POINT(114 5)')),
('a', 'o', 'f', GeomFromText('POINT(227 232)')),
('t', 'c', 'z', GeomFromText('POINT(63 62)')),
('d', 'o', 'k', GeomFromText('POINT(48 228)')),
('x', 'c', 'e', GeomFromText('POINT(204 2)')),
('e', 'e', 'g', GeomFromText('POINT(125 43)')),
('o', 'r', 'f', GeomFromText('POINT(171 140)'));
UPDATE t1 set spatial_point=GeomFromText('POINT(163 157)') where c1 like 'w%';
UPDATE t1 set spatial_point=GeomFromText('POINT(53 151)') where c1 like 'd%';
UPDATE t1 set spatial_point=GeomFromText('POINT(96 183)') where c1 like 'r%';
UPDATE t1 set spatial_point=GeomFromText('POINT(57 91)') where c1 like 'q%';
UPDATE t1 set spatial_point=GeomFromText('POINT(202 110)') where c1 like 'c%';
UPDATE t1 set spatial_point=GeomFromText('POINT(120 137)') where c1 like 'w%';
UPDATE t1 set spatial_point=GeomFromText('POINT(207 147)') where c1 like 'c%';
UPDATE t1 set spatial_point=GeomFromText('POINT(31 125)') where c1 like 'e%';
UPDATE t1 set spatial_point=GeomFromText('POINT(27 36)') where c1 like 'r%';
INSERT INTO t1 (c2, c1, c3, spatial_point) VALUES
('b', 'c', 'e', GeomFromText('POINT(41 137)')),
('p', 'y', 'k', GeomFromText('POINT(50 22)')),
('s', 'c', 'h', GeomFromText('POINT(208 173)')),
('x', 'u', 'l', GeomFromText('POINT(199 175)')),
('s', 'r', 'h', GeomFromText('POINT(85 192)')),
('j', 'k', 'u', GeomFromText('POINT(18 25)')),
('p', 'w', 'h', GeomFromText('POINT(152 197)')),
('e', 'd', 'c', GeomFromText('POINT(229 3)')),
('o', 'x', 'k', GeomFromText('POINT(187 155)')),
('o', 'b', 'k', GeomFromText('POINT(208 150)')),
('d', 'a', 'j', GeomFromText('POINT(70 87)')),
('f', 'e', 'k', GeomFromText('POINT(156 96)')),
('u', 'y', 'p', GeomFromText('POINT(239 193)')),
('n', 'v', 'p', GeomFromText('POINT(223 98)')),
('z', 'j', 'r', GeomFromText('POINT(87 89)')),
('h', 'x', 'x', GeomFromText('POINT(92 0)')),
('r', 'v', 'r', GeomFromText('POINT(159 139)')),
('v', 'g', 'g', GeomFromText('POINT(16 229)')),
('z', 'k', 'u', GeomFromText('POINT(99 52)')),
('p', 'p', 'o', GeomFromText('POINT(105 125)')),
('w', 'h', 'y', GeomFromText('POINT(105 154)')),
('v', 'y', 'z', GeomFromText('POINT(134 238)')),
('x', 'o', 'o', GeomFromText('POINT(178 88)')),
('z', 'w', 'd', GeomFromText('POINT(123 60)')),
('q', 'f', 'u', GeomFromText('POINT(64 90)')),
('s', 'n', 't', GeomFromText('POINT(50 138)')),
('v', 'p', 't', GeomFromText('POINT(114 91)')),
('a', 'o', 'n', GeomFromText('POINT(78 43)')),
('k', 'u', 'd', GeomFromText('POINT(185 161)')),
('w', 'd', 'n', GeomFromText('POINT(25 92)')),
('k', 'w', 'a', GeomFromText('POINT(59 238)')),
('t', 'c', 'f', GeomFromText('POINT(65 87)')),
('g', 's', 'p', GeomFromText('POINT(238 126)')),
('d', 'n', 'y', GeomFromText('POINT(107 173)')),
('l', 'a', 'w', GeomFromText('POINT(125 152)')),
('m', 'd', 'j', GeomFromText('POINT(146 53)')),
('q', 'm', 'c', GeomFromText('POINT(217 187)')),
('i', 'r', 'r', GeomFromText('POINT(6 113)')),
('e', 'j', 'b', GeomFromText('POINT(37 83)')),
('w', 'w', 'h', GeomFromText('POINT(83 199)')),
('k', 'b', 's', GeomFromText('POINT(170 64)')),
('s', 'b', 'c', GeomFromText('POINT(163 130)')),
('c', 'h', 'a', GeomFromText('POINT(141 3)')),
('k', 'j', 'u', GeomFromText('POINT(143 76)')),
('r', 'h', 'o', GeomFromText('POINT(243 92)')),
('i', 'd', 'b', GeomFromText('POINT(205 13)')),
('r', 'y', 'q', GeomFromText('POINT(138 8)')),
('m', 'o', 'i', GeomFromText('POINT(36 45)')),
('v', 'g', 'm', GeomFromText('POINT(0 40)')),
('f', 'e', 'i', GeomFromText('POINT(76 6)')),
('c', 'q', 'q', GeomFromText('POINT(115 248)')),
('x', 'c', 'i', GeomFromText('POINT(29 74)')),
('l', 's', 't', GeomFromText('POINT(83 18)')),
('t', 't', 'a', GeomFromText('POINT(26 168)')),
('u', 'n', 'x', GeomFromText('POINT(200 110)')),
('j', 'b', 'd', GeomFromText('POINT(216 136)')),
('s', 'p', 'w', GeomFromText('POINT(38 156)')),
('f', 'b', 'v', GeomFromText('POINT(29 186)')),
('v', 'e', 'r', GeomFromText('POINT(149 40)')),
('v', 't', 'm', GeomFromText('POINT(184 24)')),
('y', 'g', 'a', GeomFromText('POINT(219 105)')),
('s', 'f', 'i', GeomFromText('POINT(114 130)')),
('e', 'q', 'h', GeomFromText('POINT(203 135)')),
('h', 'g', 'b', GeomFromText('POINT(9 208)')),
('o', 'l', 'r', GeomFromText('POINT(245 79)')),
('s', 's', 'v', GeomFromText('POINT(238 198)')),
('w', 'w', 'z', GeomFromText('POINT(209 232)')),
('v', 'd', 'n', GeomFromText('POINT(30 193)')),
('q', 'w', 'k', GeomFromText('POINT(133 18)')),
('o', 'h', 'o', GeomFromText('POINT(42 140)')),
('f', 'f', 'h', GeomFromText('POINT(145 1)')),
('u', 's', 'r', GeomFromText('POINT(70 62)')),
('x', 'n', 'q', GeomFromText('POINT(33 86)')),
('u', 'p', 'v', GeomFromText('POINT(232 220)')),
('z', 'e', 'a', GeomFromText('POINT(130 69)')),
('r', 'u', 'z', GeomFromText('POINT(243 241)')),
('b', 'n', 't', GeomFromText('POINT(120 12)')),
('u', 'f', 's', GeomFromText('POINT(190 212)')),
('a', 'd', 'q', GeomFromText('POINT(235 191)')),
('f', 'q', 'm', GeomFromText('POINT(176 2)')),
('n', 'c', 's', GeomFromText('POINT(218 163)')),
('e', 'm', 'h', GeomFromText('POINT(163 108)')),
('c', 'f', 'l', GeomFromText('POINT(220 115)')),
('c', 'v', 'q', GeomFromText('POINT(66 45)')),
('w', 'v', 'x', GeomFromText('POINT(251 220)')),
('f', 'w', 'z', GeomFromText('POINT(146 149)')),
('h', 'n', 'h', GeomFromText('POINT(148 128)')),
('y', 'k', 'v', GeomFromText('POINT(28 110)')),
('c', 'x', 'q', GeomFromText('POINT(13 13)')),
('e', 'd', 's', GeomFromText('POINT(91 190)')),
('c', 'w', 'c', GeomFromText('POINT(10 231)')),
('u', 'j', 'n', GeomFromText('POINT(250 21)')),
('w', 'n', 'x', GeomFromText('POINT(141 69)')),
('f', 'p', 'y', GeomFromText('POINT(228 246)')),
('d', 'q', 'f', GeomFromText('POINT(194 22)')),
('d', 'z', 'l', GeomFromText('POINT(233 181)')),
('c', 'a', 'q', GeomFromText('POINT(183 96)')),
('m', 'i', 'd', GeomFromText('POINT(117 226)')),
('z', 'y', 'y', GeomFromText('POINT(62 81)')),
('g', 'v', 'm', GeomFromText('POINT(66 158)'));
SET @@RAND_SEED1=481064922, @@RAND_SEED2=438133497;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
SET @@RAND_SEED1=280535103, @@RAND_SEED2=444518646;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
SET @@RAND_SEED1=1072017234, @@RAND_SEED2=484203885;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
SET @@RAND_SEED1=358851897, @@RAND_SEED2=358495224;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
SET @@RAND_SEED1=509031459, @@RAND_SEED2=675962925;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
UPDATE t1 set spatial_point=GeomFromText('POINT(61 203)') where c1 like 'y%';
UPDATE t1 set spatial_point=GeomFromText('POINT(202 194)') where c1 like 'f%';
UPDATE t1 set spatial_point=GeomFromText('POINT(228 18)') where c1 like 'h%';
UPDATE t1 set spatial_point=GeomFromText('POINT(88 18)') where c1 like 'l%';
UPDATE t1 set spatial_point=GeomFromText('POINT(176 94)') where c1 like 'e%';
UPDATE t1 set spatial_point=GeomFromText('POINT(44 47)') where c1 like 'g%';
UPDATE t1 set spatial_point=GeomFromText('POINT(95 191)') where c1 like 'b%';
UPDATE t1 set spatial_point=GeomFromText('POINT(179 218)') where c1 like 'y%';
UPDATE t1 set spatial_point=GeomFromText('POINT(239 40)') where c1 like 'g%';
UPDATE t1 set spatial_point=GeomFromText('POINT(248 41)') where c1 like 'q%';
UPDATE t1 set spatial_point=GeomFromText('POINT(167 82)') where c1 like 't%';
UPDATE t1 set spatial_point=GeomFromText('POINT(13 104)') where c1 like 'u%';
UPDATE t1 set spatial_point=GeomFromText('POINT(139 84)') where c1 like 'a%';
UPDATE t1 set spatial_point=GeomFromText('POINT(145 108)') where c1 like 'p%';
UPDATE t1 set spatial_point=GeomFromText('POINT(147 57)') where c1 like 't%';
UPDATE t1 set spatial_point=GeomFromText('POINT(217 144)') where c1 like 'n%';
UPDATE t1 set spatial_point=GeomFromText('POINT(160 224)') where c1 like 'w%';
UPDATE t1 set spatial_point=GeomFromText('POINT(38 28)') where c1 like 'j%';
UPDATE t1 set spatial_point=GeomFromText('POINT(104 114)') where c1 like 'q%';
UPDATE t1 set spatial_point=GeomFromText('POINT(88 19)') where c1 like 'c%';
INSERT INTO t1 (c2, c1, c3, spatial_point) VALUES
('f', 'x', 'p', GeomFromText('POINT(92 181)')),
('s', 'i', 'c', GeomFromText('POINT(49 60)')),
('c', 'c', 'i', GeomFromText('POINT(7 57)')),
('n', 'g', 'k', GeomFromText('POINT(252 105)')),
('g', 'b', 'm', GeomFromText('POINT(180 11)')),
('u', 'l', 'r', GeomFromText('POINT(32 90)')),
('c', 'x', 'e', GeomFromText('POINT(143 24)')),
('x', 'u', 'a', GeomFromText('POINT(123 92)')),
('s', 'b', 'h', GeomFromText('POINT(190 108)')),
('c', 'x', 'b', GeomFromText('POINT(104 100)')),
('i', 'd', 't', GeomFromText('POINT(214 104)')),
('r', 'w', 'g', GeomFromText('POINT(29 67)')),
('b', 'f', 'g', GeomFromText('POINT(149 46)')),
('r', 'r', 'd', GeomFromText('POINT(242 196)')),
('j', 'l', 'a', GeomFromText('POINT(90 196)')),
('e', 't', 'b', GeomFromText('POINT(190 64)')),
('l', 'x', 'w', GeomFromText('POINT(250 73)')),
('q', 'y', 'r', GeomFromText('POINT(120 182)')),
('s', 'j', 'a', GeomFromText('POINT(180 175)')),
('n', 'i', 'y', GeomFromText('POINT(124 136)')),
('s', 'x', 's', GeomFromText('POINT(176 209)')),
('u', 'f', 's', GeomFromText('POINT(215 173)')),
('m', 'j', 'x', GeomFromText('POINT(44 140)')),
('v', 'g', 'x', GeomFromText('POINT(177 233)')),
('u', 't', 'b', GeomFromText('POINT(136 197)')),
('f', 'g', 'b', GeomFromText('POINT(10 8)')),
('v', 'c', 'j', GeomFromText('POINT(13 81)')),
('d', 's', 'q', GeomFromText('POINT(200 100)')),
('a', 'p', 'j', GeomFromText('POINT(33 40)')),
('i', 'c', 'g', GeomFromText('POINT(168 204)')),
('k', 'h', 'i', GeomFromText('POINT(93 243)')),
('s', 'b', 's', GeomFromText('POINT(157 13)')),
('v', 'l', 'l', GeomFromText('POINT(103 6)')),
('r', 'b', 'k', GeomFromText('POINT(244 137)')),
('l', 'd', 'r', GeomFromText('POINT(162 254)')),
('q', 'b', 'z', GeomFromText('POINT(136 246)')),
('x', 'x', 'p', GeomFromText('POINT(120 37)')),
('m', 'e', 'z', GeomFromText('POINT(203 167)')),
('q', 'n', 'p', GeomFromText('POINT(94 119)')),
('b', 'g', 'u', GeomFromText('POINT(93 248)')),
('r', 'v', 'v', GeomFromText('POINT(53 88)')),
('y', 'a', 'i', GeomFromText('POINT(98 219)')),
('a', 's', 'g', GeomFromText('POINT(173 138)')),
('c', 'a', 't', GeomFromText('POINT(235 135)')),
('q', 'm', 'd', GeomFromText('POINT(224 208)')),
('e', 'p', 'k', GeomFromText('POINT(161 238)')),
('n', 'g', 'q', GeomFromText('POINT(35 204)')),
('t', 't', 'x', GeomFromText('POINT(230 178)')),
('w', 'f', 'a', GeomFromText('POINT(150 221)')),
('z', 'm', 'z', GeomFromText('POINT(119 42)')),
('l', 'j', 's', GeomFromText('POINT(97 96)')),
('f', 'z', 'x', GeomFromText('POINT(208 65)')),
('i', 'v', 'c', GeomFromText('POINT(145 79)')),
('l', 'f', 'k', GeomFromText('POINT(83 234)')),
('u', 'a', 's', GeomFromText('POINT(250 49)')),
('o', 'k', 'p', GeomFromText('POINT(46 50)')),
('d', 'e', 'z', GeomFromText('POINT(30 198)')),
('r', 'r', 'l', GeomFromText('POINT(78 189)')),
('y', 'l', 'f', GeomFromText('POINT(188 132)')),
('d', 'q', 'm', GeomFromText('POINT(247 107)')),
('p', 'j', 'n', GeomFromText('POINT(148 227)')),
('b', 'o', 'i', GeomFromText('POINT(172 25)')),
('e', 'v', 'd', GeomFromText('POINT(94 248)')),
('q', 'd', 'f', GeomFromText('POINT(15 29)')),
('w', 'b', 'b', GeomFromText('POINT(74 111)')),
('g', 'q', 'f', GeomFromText('POINT(107 215)')),
('o', 'h', 'r', GeomFromText('POINT(25 168)')),
('u', 't', 'w', GeomFromText('POINT(251 188)')),
('h', 's', 'w', GeomFromText('POINT(254 247)')),
('f', 'f', 'b', GeomFromText('POINT(166 103)'));
SET @@RAND_SEED1=866613816, @@RAND_SEED2=92289615;
INSERT INTO t1 (c2, c1, c3, spatial_point) VALUES
('l', 'c', 'l', GeomFromText('POINT(202 98)')),
('k', 'c', 'b', GeomFromText('POINT(46 206)')),
('r', 'y', 'm', GeomFromText('POINT(74 140)')),
('y', 'z', 'd', GeomFromText('POINT(200 160)')),
('s', 'y', 's', GeomFromText('POINT(156 205)')),
('u', 'v', 'p', GeomFromText('POINT(86 82)')),
('j', 's', 's', GeomFromText('POINT(91 233)')),
('x', 'j', 'f', GeomFromText('POINT(3 14)')),
('l', 'z', 'v', GeomFromText('POINT(123 156)')),
('h', 'i', 'o', GeomFromText('POINT(145 229)')),
('o', 'r', 'd', GeomFromText('POINT(15 22)')),
('f', 'x', 't', GeomFromText('POINT(21 60)')),
('t', 'g', 'h', GeomFromText('POINT(50 153)')),
('g', 'u', 'b', GeomFromText('POINT(82 85)')),
('v', 'a', 'p', GeomFromText('POINT(231 178)')),
('n', 'v', 'o', GeomFromText('POINT(183 25)')),
('j', 'n', 'm', GeomFromText('POINT(50 144)')),
('e', 'f', 'i', GeomFromText('POINT(46 16)')),
('d', 'w', 'a', GeomFromText('POINT(66 6)')),
('f', 'x', 'a', GeomFromText('POINT(107 197)')),
('m', 'o', 'a', GeomFromText('POINT(142 80)')),
('q', 'l', 'g', GeomFromText('POINT(251 23)')),
('c', 's', 's', GeomFromText('POINT(158 43)')),
('y', 'd', 'o', GeomFromText('POINT(196 228)')),
('d', 'p', 'l', GeomFromText('POINT(107 5)')),
('h', 'a', 'b', GeomFromText('POINT(183 166)')),
('m', 'w', 'p', GeomFromText('POINT(19 59)')),
('b', 'y', 'o', GeomFromText('POINT(178 30)')),
('x', 'w', 'i', GeomFromText('POINT(168 94)')),
('t', 'k', 'z', GeomFromText('POINT(171 5)')),
('r', 'm', 'a', GeomFromText('POINT(222 19)')),
('u', 'v', 'e', GeomFromText('POINT(224 80)')),
('q', 'r', 'k', GeomFromText('POINT(212 218)')),
('d', 'p', 'j', GeomFromText('POINT(169 7)')),
('d', 'r', 'v', GeomFromText('POINT(193 23)')),
('n', 'y', 'y', GeomFromText('POINT(130 178)')),
('m', 'z', 'r', GeomFromText('POINT(81 200)')),
('j', 'e', 'w', GeomFromText('POINT(145 239)')),
('v', 'h', 'x', GeomFromText('POINT(24 105)')),
('z', 'm', 'a', GeomFromText('POINT(175 129)')),
('b', 'c', 'v', GeomFromText('POINT(213 10)')),
('t', 't', 'u', GeomFromText('POINT(2 129)')),
('r', 's', 'v', GeomFromText('POINT(209 192)')),
('x', 'p', 'g', GeomFromText('POINT(43 63)')),
('t', 'e', 'u', GeomFromText('POINT(139 210)')),
('l', 'e', 't', GeomFromText('POINT(245 148)')),
('a', 'i', 'k', GeomFromText('POINT(167 195)')),
('m', 'o', 'h', GeomFromText('POINT(206 120)')),
('g', 'z', 's', GeomFromText('POINT(169 240)')),
('z', 'u', 's', GeomFromText('POINT(202 120)')),
('i', 'b', 'a', GeomFromText('POINT(216 18)')),
('w', 'y', 'g', GeomFromText('POINT(119 236)')),
('h', 'y', 'p', GeomFromText('POINT(161 24)'));
UPDATE t1 set spatial_point=GeomFromText('POINT(33 100)') where c1 like 't%';
UPDATE t1 set spatial_point=GeomFromText('POINT(41 46)') where c1 like 'f%';
CHECK TABLE t1 EXTENDED;
DROP TABLE t1;
#
# Bug #30286 spatial index cause corruption and server crash!
#
create table t1 (a geometry not null, spatial index(a)) row_format=dynamic;
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 131072)));
insert into t1 values (PointFromWKB(POINT(9.1248812352444e+192, 2.9740338169556e+284)));
insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, -0)));
insert into t1 values (PointFromWKB(POINT(1.49166814624e-154, 2.0880974297595e-53)));
insert into t1 values (PointFromWKB(POINT(4.0917382598702e+149, 1.2024538023802e+111)));
insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 2.9993936277913e-241)));
insert into t1 values (PointFromWKB(POINT(2.5243548967072e-29, 1.2024538023802e+111)));
insert into t1 values (PointFromWKB(POINT(0, 6.9835074892995e-251)));
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 3.1050361846014e+231)));
insert into t1 values (PointFromWKB(POINT(2.8728483499323e-188, 2.4600631144627e+260)));
insert into t1 values (PointFromWKB(POINT(3.0517578125e-05, 2.0349165139404e+236)));
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 1.1818212630766e-125)));
insert into t1 values (PointFromWKB(POINT(2.481040258324e-265, 5.7766220027675e-275)));
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 2.5243548967072e-29)));
insert into t1 values (PointFromWKB(POINT(5.7766220027675e-275, 9.9464647281957e+86)));
insert into t1 values (PointFromWKB(POINT(2.2181357552967e+130, 3.7857669957337e-270)));
insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.6893488147419e+19)));
insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.7537584144024e+255)));
insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 1.8033161362863e-130)));
insert into t1 values (PointFromWKB(POINT(0, 5.8774717541114e-39)));
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 2.2761049594727e-159)));
insert into t1 values (PointFromWKB(POINT(6.243497100632e+144, 3.7857669957337e-270)));
insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 2.6355494858076e-82)));
insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 3.8518598887745e-34)));
insert into t1 values (PointFromWKB(POINT(4.6566128730774e-10, 2.0880974297595e-53)));
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 1.8827498946116e-183)));
insert into t1 values (PointFromWKB(POINT(1.8033161362863e-130, 9.1248812352444e+192)));
insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, 2.2761049594727e-159)));
insert into t1 values (PointFromWKB(POINT(1.94906280228e+289, 1.2338789709327e-178)));
drop table t1;
# End of 4.1 tests
#
# bug #21790 (UNKNOWN ERROR on NULLs in RTree)
#
CREATE TABLE t1(foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) ) row_format=dynamic;
--error 1048
INSERT INTO t1(foo) VALUES (NULL);
--error 1416
INSERT INTO t1() VALUES ();
--error 1416
INSERT INTO t1(foo) VALUES ('');
DROP TABLE t1;
#
# Bug #23578: Corruption prevents Optimize table from working properly with a
# spatial index
#
CREATE TABLE t1 (a INT AUTO_INCREMENT, b POINT NOT NULL, KEY (a), SPATIAL KEY (b)) row_format=dynamic;
INSERT INTO t1 (b) VALUES (GeomFromText('POINT(1 2)'));
INSERT INTO t1 (b) SELECT b FROM t1;
INSERT INTO t1 (b) SELECT b FROM t1;
INSERT INTO t1 (b) SELECT b FROM t1;
INSERT INTO t1 (b) SELECT b FROM t1;
INSERT INTO t1 (b) SELECT b FROM t1;
OPTIMIZE TABLE t1;
DROP TABLE t1;
#
# Bug #29070: Error in spatial index
#
CREATE TABLE t1 (a INT, b GEOMETRY NOT NULL, SPATIAL KEY b(b)) row_format=dynamic;
INSERT INTO t1 VALUES (1, GEOMFROMTEXT('LINESTRING(1102218.456 1,2000000 2)'));
INSERT INTO t1 VALUES (2, GEOMFROMTEXT('LINESTRING(1102218.456 1,2000000 2)'));
# must return the same number as the next select
SELECT COUNT(*) FROM t1 WHERE
MBRINTERSECTS(b, GEOMFROMTEXT('LINESTRING(1 1,1102219 2)') );
SELECT COUNT(*) FROM t1 IGNORE INDEX (b) WHERE
MBRINTERSECTS(b, GEOMFROMTEXT('LINESTRING(1 1,1102219 2)') );
DROP TABLE t1;
--echo End of 5.0 tests.
# Because state.key_root is updated differently between transactional
# and non-trans tables, we have several maria-gis-rtree-* tests.
-- source include/have_maria.inc
-- source include/have_geometry.inc
set storage_engine=maria;
#
# test of rtree (using with spatial data)
#
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
--enable_warnings
CREATE TABLE t1 (
fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
g GEOMETRY NOT NULL,
SPATIAL KEY(g)
) transactional=1 row_format=page;
SHOW CREATE TABLE t1;
let $1=150;
let $2=150;
while ($1)
{
eval INSERT INTO t1 (g) VALUES (GeomFromText('LineString($1 $1, $2 $2)'));
dec $1;
inc $2;
}
SELECT count(*) FROM t1;
EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
DROP TABLE t1;
CREATE TABLE t2 (
fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
g GEOMETRY NOT NULL
) transactional=1 row_format=page;
let $1=10;
while ($1)
{
let $2=10;
while ($2)
{
eval INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point($1 * 10 - 9, $2 * 10 - 9), Point($1 * 10, $2 * 10))));
dec $2;
}
dec $1;
}
ALTER TABLE t2 ADD SPATIAL KEY(g);
SHOW CREATE TABLE t2;
SELECT count(*) FROM t2;
EXPLAIN SELECT fid, AsText(g) FROM t2 WHERE Within(g,
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
SELECT fid, AsText(g) FROM t2 WHERE Within(g,
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
let $1=10;
while ($1)
{
let $2=10;
while ($2)
{
eval DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point($1 * 10 - 9, $2 * 10 - 9), Point($1 * 10, $2 * 10)))));
SELECT count(*) FROM t2;
dec $2;
}
dec $1;
}
DROP TABLE t2;
drop table if exists t1;
CREATE TABLE t1 (a geometry NOT NULL, SPATIAL (a)) transactional=1 row_format=page;
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
check table t1;
analyze table t1;
drop table t1;
#
# The following crashed gis
#
CREATE TABLE t1 (
fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
g GEOMETRY NOT NULL,
SPATIAL KEY(g)
) transactional=1 row_format=page;
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(1 2, 2 3)')),(GeomFromText('LineString(1 2, 2 4)'));
#select * from t1 where g<GeomFromText('LineString(1 2, 2 3)');
drop table t1;
CREATE TABLE t1 (
line LINESTRING NOT NULL,
kind ENUM('po', 'pp', 'rr', 'dr', 'rd', 'ts', 'cl') NOT NULL DEFAULT 'po',
name VARCHAR(32),
SPATIAL KEY (line)
) transactional=1 row_format=page;
ALTER TABLE t1 DISABLE KEYS;
INSERT INTO t1 (name, kind, line) VALUES
("Aadaouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
("Aadassiye", "pp", GeomFromText("POINT(35.816667 36.216667)")),
("Aadbel", "pp", GeomFromText("POINT(34.533333 36.100000)")),
("Aadchit", "pp", GeomFromText("POINT(33.347222 35.423611)")),
("Aadchite", "pp", GeomFromText("POINT(33.347222 35.423611)")),
("Aadchit el Qoussair", "pp", GeomFromText("POINT(33.283333 35.483333)")),
("Aaddaye", "pp", GeomFromText("POINT(36.716667 40.833333)")),
("'Aadeissa", "pp", GeomFromText("POINT(32.823889 35.698889)")),
("Aaderup", "pp", GeomFromText("POINT(55.216667 11.766667)")),
("Qalaat Aades", "pp", GeomFromText("POINT(33.503333 35.377500)")),
("A ad'ino", "pp", GeomFromText("POINT(54.812222 38.209167)")),
("Aadi Noia", "pp", GeomFromText("POINT(13.800000 39.833333)")),
("Aad La Macta", "pp", GeomFromText("POINT(35.779444 -0.129167)")),
("Aadland", "pp", GeomFromText("POINT(60.366667 5.483333)")),
("Aadliye", "pp", GeomFromText("POINT(33.366667 36.333333)")),
("Aadloun", "pp", GeomFromText("POINT(33.403889 35.273889)")),
("Aadma", "pp", GeomFromText("POINT(58.798333 22.663889)")),
("Aadma Asundus", "pp", GeomFromText("POINT(58.798333 22.663889)")),
("Aadmoun", "pp", GeomFromText("POINT(34.150000 35.650000)")),
("Aadneram", "pp", GeomFromText("POINT(59.016667 6.933333)")),
("Aadneskaar", "pp", GeomFromText("POINT(58.083333 6.983333)")),
("Aadorf", "pp", GeomFromText("POINT(47.483333 8.900000)")),
("Aadorp", "pp", GeomFromText("POINT(52.366667 6.633333)")),
("Aadouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
("Aadoui", "pp", GeomFromText("POINT(34.450000 35.983333)")),
("Aadouiye", "pp", GeomFromText("POINT(34.583333 36.183333)")),
("Aadouss", "pp", GeomFromText("POINT(33.512500 35.601389)")),
("Aadra", "pp", GeomFromText("POINT(33.616667 36.500000)")),
("Aadzi", "pp", GeomFromText("POINT(38.100000 64.850000)"));
ALTER TABLE t1 ENABLE KEYS;
INSERT INTO t1 (name, kind, line) VALUES ("austria", "pp", GeomFromText('LINESTRING(14.9906 48.9887,14.9946 48.9904,14.9947 48.9916)'));
drop table t1;
CREATE TABLE t1 (st varchar(100));
INSERT INTO t1 VALUES ("Fake string");
CREATE TABLE t2 (geom GEOMETRY NOT NULL, SPATIAL KEY gk(geom)) transactional=1 row_format=page;
--error 1416
INSERT INTO t2 SELECT GeomFromText(st) FROM t1;
drop table t1, t2;
CREATE TABLE t1 (`geometry` geometry NOT NULL default '',SPATIAL KEY `gndx` (`geometry`)) transactional=1 row_format=page DEFAULT CHARSET=latin1;
INSERT INTO t1 (geometry) VALUES
(PolygonFromText('POLYGON((-18.6086111000 -66.9327777000, -18.6055555000
-66.8158332999, -18.7186111000 -66.8102777000, -18.7211111000 -66.9269443999,
-18.6086111000 -66.9327777000))'));
INSERT INTO t1 (geometry) VALUES
(PolygonFromText('POLYGON((-65.7402776999 -96.6686111000, -65.7372222000
-96.5516666000, -65.8502777000 -96.5461111000, -65.8527777000 -96.6627777000,
-65.7402776999 -96.6686111000))'));
check table t1 extended;
drop table t1;
#
# Bug#17877 - Corrupted spatial index
#
CREATE TABLE t1 (
c1 geometry NOT NULL default '',
SPATIAL KEY i1 (c1)
) transactional=1 row_format=page DEFAULT CHARSET=latin1;
INSERT INTO t1 (c1) VALUES (
PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
-18.6055555000 -66.8158332999,
-18.7186111000 -66.8102777000,
-18.7211111000 -66.9269443999,
-18.6086111000 -66.9327777000))'));
# This showed a missing key.
CHECK TABLE t1 EXTENDED;
DROP TABLE t1;
#
CREATE TABLE t1 (
c1 geometry NOT NULL default '',
SPATIAL KEY i1 (c1)
) transactional=1 row_format=page DEFAULT CHARSET=latin1;
INSERT INTO t1 (c1) VALUES (
PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
-18.6055555000 -66.8158332999,
-18.7186111000 -66.8102777000,
-18.7211111000 -66.9269443999,
-18.6086111000 -66.9327777000))'));
INSERT INTO t1 (c1) VALUES (
PolygonFromText('POLYGON((-65.7402776999 -96.6686111000,
-65.7372222000 -96.5516666000,
-65.8502777000 -96.5461111000,
-65.8527777000 -96.6627777000,
-65.7402776999 -96.6686111000))'));
# This is the same as the first insert to get a non-unique key.
INSERT INTO t1 (c1) VALUES (
PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
-18.6055555000 -66.8158332999,
-18.7186111000 -66.8102777000,
-18.7211111000 -66.9269443999,
-18.6086111000 -66.9327777000))'));
# This showed (and still shows) OK.
CHECK TABLE t1 EXTENDED;
DROP TABLE t1;
#
# Bug #21888: Query on GEOMETRY field using PointFromWKB() results in lost connection
#
CREATE TABLE t1 (foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) ) transactional=1 row_format=page;
INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(1,1)));
INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(1,0)));
INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(0,1)));
INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(0,0)));
SELECT 1 FROM t1 WHERE foo != PointFromWKB(POINT(0,0));
DROP TABLE t1;
#
# Bug#25673 - spatial index corruption, error 126 incorrect key file for table
#
CREATE TABLE t1 (id bigint(12) unsigned NOT NULL auto_increment,
c2 varchar(15) collate utf8_bin default NULL,
c1 varchar(15) collate utf8_bin default NULL,
c3 varchar(10) collate utf8_bin default NULL,
spatial_point point NOT NULL,
PRIMARY KEY(id),
SPATIAL KEY (spatial_point)
)transactional=1 row_format=page DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
#
INSERT INTO t1 (c2, c1, c3, spatial_point) VALUES
('y', 's', 'j', GeomFromText('POINT(167 74)')),
('r', 'n', 'd', GeomFromText('POINT(215 118)')),
('g', 'n', 'e', GeomFromText('POINT(203 98)')),
('h', 'd', 'd', GeomFromText('POINT(54 193)')),
('r', 'x', 'y', GeomFromText('POINT(47 69)')),
('t', 'q', 'r', GeomFromText('POINT(109 42)')),
('a', 'z', 'd', GeomFromText('POINT(0 154)')),
('x', 'v', 'o', GeomFromText('POINT(174 131)')),
('b', 'r', 'a', GeomFromText('POINT(114 253)')),
('x', 'z', 'i', GeomFromText('POINT(163 21)')),
('w', 'p', 'i', GeomFromText('POINT(42 102)')),
('g', 'j', 'j', GeomFromText('POINT(170 133)')),
('m', 'g', 'n', GeomFromText('POINT(28 22)')),
('b', 'z', 'h', GeomFromText('POINT(174 28)')),
('q', 'k', 'f', GeomFromText('POINT(233 73)')),
('w', 'w', 'a', GeomFromText('POINT(124 200)')),
('t', 'j', 'w', GeomFromText('POINT(252 101)')),
('d', 'r', 'd', GeomFromText('POINT(98 18)')),
('w', 'o', 'y', GeomFromText('POINT(165 31)')),
('y', 'h', 't', GeomFromText('POINT(14 220)')),
('d', 'p', 'u', GeomFromText('POINT(223 196)')),
('g', 'y', 'g', GeomFromText('POINT(207 96)')),
('x', 'm', 'n', GeomFromText('POINT(214 3)')),
('g', 'v', 'e', GeomFromText('POINT(140 205)')),
('g', 'm', 'm', GeomFromText('POINT(10 236)')),
('i', 'r', 'j', GeomFromText('POINT(137 228)')),
('w', 's', 'p', GeomFromText('POINT(115 6)')),
('o', 'n', 'k', GeomFromText('POINT(158 129)')),
('j', 'h', 'l', GeomFromText('POINT(129 72)')),
('f', 'x', 'l', GeomFromText('POINT(139 207)')),
('u', 'd', 'n', GeomFromText('POINT(125 109)')),
('b', 'a', 'z', GeomFromText('POINT(30 32)')),
('m', 'h', 'o', GeomFromText('POINT(251 251)')),
('f', 'r', 'd', GeomFromText('POINT(243 211)')),
('b', 'd', 'r', GeomFromText('POINT(232 80)')),
('g', 'k', 'v', GeomFromText('POINT(15 100)')),
('i', 'f', 'c', GeomFromText('POINT(109 66)')),
('r', 't', 'j', GeomFromText('POINT(178 6)')),
('y', 'n', 'f', GeomFromText('POINT(233 211)')),
('f', 'y', 'm', GeomFromText('POINT(99 16)')),
('z', 'q', 'l', GeomFromText('POINT(39 49)')),
('j', 'c', 'r', GeomFromText('POINT(75 187)')),
('c', 'y', 'y', GeomFromText('POINT(246 253)')),
('w', 'u', 'd', GeomFromText('POINT(56 190)')),
('n', 'q', 'm', GeomFromText('POINT(73 149)')),
('d', 'y', 'a', GeomFromText('POINT(134 6)')),
('z', 's', 'w', GeomFromText('POINT(216 225)')),
('d', 'u', 'k', GeomFromText('POINT(132 70)')),
('f', 'v', 't', GeomFromText('POINT(187 141)')),
('r', 'r', 'a', GeomFromText('POINT(152 39)')),
('y', 'p', 'o', GeomFromText('POINT(45 27)')),
('p', 'n', 'm', GeomFromText('POINT(228 148)')),
('e', 'g', 'e', GeomFromText('POINT(88 81)')),
('m', 'a', 'h', GeomFromText('POINT(35 29)')),
('m', 'h', 'f', GeomFromText('POINT(30 71)')),
('h', 'k', 'i', GeomFromText('POINT(244 78)')),
('z', 'v', 'd', GeomFromText('POINT(241 38)')),
('q', 'l', 'j', GeomFromText('POINT(13 71)')),
('s', 'p', 'g', GeomFromText('POINT(108 38)')),
('q', 's', 'j', GeomFromText('POINT(92 101)')),
('l', 'h', 'g', GeomFromText('POINT(120 78)')),
('w', 't', 'b', GeomFromText('POINT(193 109)')),
('b', 's', 's', GeomFromText('POINT(223 211)')),
('w', 'w', 'y', GeomFromText('POINT(122 42)')),
('q', 'c', 'c', GeomFromText('POINT(104 102)')),
('w', 'g', 'n', GeomFromText('POINT(213 120)')),
('p', 'q', 'a', GeomFromText('POINT(247 148)')),
('c', 'z', 'e', GeomFromText('POINT(18 106)')),
('z', 'u', 'n', GeomFromText('POINT(70 133)')),
('j', 'n', 'x', GeomFromText('POINT(232 13)')),
('e', 'h', 'f', GeomFromText('POINT(22 135)')),
('w', 'l', 'f', GeomFromText('POINT(9 180)')),
('a', 'v', 'q', GeomFromText('POINT(163 228)')),
('i', 'z', 'o', GeomFromText('POINT(180 100)')),
('e', 'c', 'l', GeomFromText('POINT(182 231)')),
('c', 'k', 'o', GeomFromText('POINT(19 60)')),
('q', 'f', 'p', GeomFromText('POINT(79 95)')),
('m', 'd', 'r', GeomFromText('POINT(3 127)')),
('m', 'e', 't', GeomFromText('POINT(136 154)')),
('w', 'w', 'w', GeomFromText('POINT(102 15)')),
('l', 'n', 'q', GeomFromText('POINT(71 196)')),
('p', 'k', 'c', GeomFromText('POINT(47 139)')),
('j', 'o', 'r', GeomFromText('POINT(177 128)')),
('j', 'q', 'a', GeomFromText('POINT(170 6)')),
('b', 'a', 'o', GeomFromText('POINT(63 211)')),
('g', 's', 'o', GeomFromText('POINT(144 251)')),
('w', 'u', 'w', GeomFromText('POINT(221 214)')),
('g', 'a', 'm', GeomFromText('POINT(14 102)')),
('u', 'q', 'z', GeomFromText('POINT(86 200)')),
('k', 'a', 'm', GeomFromText('POINT(144 222)')),
('j', 'u', 'r', GeomFromText('POINT(216 142)')),
('q', 'k', 'v', GeomFromText('POINT(121 236)')),
('p', 'o', 'r', GeomFromText('POINT(108 102)')),
('b', 'd', 'x', GeomFromText('POINT(127 198)')),
('k', 's', 'a', GeomFromText('POINT(2 150)')),
('f', 'm', 'f', GeomFromText('POINT(160 191)')),
('q', 'y', 'x', GeomFromText('POINT(98 111)')),
('o', 'f', 'm', GeomFromText('POINT(232 218)')),
('c', 'w', 'j', GeomFromText('POINT(156 165)')),
('s', 'q', 'v', GeomFromText('POINT(98 161)'));
SET @@RAND_SEED1=692635050, @@RAND_SEED2=297339954;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
SET @@RAND_SEED1=159925977, @@RAND_SEED2=942570618;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
SET @@RAND_SEED1=328169745, @@RAND_SEED2=410451954;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
SET @@RAND_SEED1=178507359, @@RAND_SEED2=332493072;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
SET @@RAND_SEED1=1034033013, @@RAND_SEED2=558966507;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
UPDATE t1 set spatial_point=GeomFromText('POINT(230 9)') where c1 like 'y%';
UPDATE t1 set spatial_point=GeomFromText('POINT(95 35)') where c1 like 'j%';
UPDATE t1 set spatial_point=GeomFromText('POINT(93 99)') where c1 like 'a%';
UPDATE t1 set spatial_point=GeomFromText('POINT(19 81)') where c1 like 'r%';
UPDATE t1 set spatial_point=GeomFromText('POINT(20 177)') where c1 like 'h%';
UPDATE t1 set spatial_point=GeomFromText('POINT(221 193)') where c1 like 'u%';
UPDATE t1 set spatial_point=GeomFromText('POINT(195 205)') where c1 like 'd%';
UPDATE t1 set spatial_point=GeomFromText('POINT(15 213)') where c1 like 'u%';
UPDATE t1 set spatial_point=GeomFromText('POINT(214 63)') where c1 like 'n%';
UPDATE t1 set spatial_point=GeomFromText('POINT(243 171)') where c1 like 'c%';
UPDATE t1 set spatial_point=GeomFromText('POINT(198 82)') where c1 like 'y%';
INSERT INTO t1 (c2, c1, c3, spatial_point) VALUES
('f', 'y', 'p', GeomFromText('POINT(109 235)')),
('b', 'e', 'v', GeomFromText('POINT(20 48)')),
('i', 'u', 'f', GeomFromText('POINT(15 55)')),
('o', 'r', 'z', GeomFromText('POINT(105 64)')),
('a', 'p', 'a', GeomFromText('POINT(142 236)')),
('g', 'i', 'k', GeomFromText('POINT(10 49)')),
('x', 'z', 'x', GeomFromText('POINT(192 200)')),
('c', 'v', 'r', GeomFromText('POINT(94 168)')),
('y', 'z', 'e', GeomFromText('POINT(141 51)')),
('h', 'm', 'd', GeomFromText('POINT(35 251)')),
('v', 'm', 'q', GeomFromText('POINT(44 90)')),
('j', 'l', 'z', GeomFromText('POINT(67 237)')),
('i', 'v', 'a', GeomFromText('POINT(75 14)')),
('b', 'q', 't', GeomFromText('POINT(153 33)')),
('e', 'm', 'a', GeomFromText('POINT(247 49)')),
('l', 'y', 'g', GeomFromText('POINT(56 203)')),
('v', 'o', 'r', GeomFromText('POINT(90 54)')),
('r', 'n', 'd', GeomFromText('POINT(135 83)')),
('j', 't', 'u', GeomFromText('POINT(174 239)')),
('u', 'n', 'g', GeomFromText('POINT(104 191)')),
('p', 'q', 'y', GeomFromText('POINT(63 171)')),
('o', 'q', 'p', GeomFromText('POINT(192 103)')),
('f', 'x', 'e', GeomFromText('POINT(244 30)')),
('n', 'x', 'c', GeomFromText('POINT(92 103)')),
('r', 'q', 'z', GeomFromText('POINT(166 20)')),
('s', 'a', 'j', GeomFromText('POINT(137 205)')),
('z', 't', 't', GeomFromText('POINT(99 134)')),
('o', 'm', 'j', GeomFromText('POINT(217 3)')),
('n', 'h', 'j', GeomFromText('POINT(211 17)')),
('v', 'v', 'a', GeomFromText('POINT(41 137)')),
('q', 'o', 'j', GeomFromText('POINT(5 92)')),
('z', 'y', 'e', GeomFromText('POINT(175 212)')),
('j', 'z', 'h', GeomFromText('POINT(224 194)')),
('a', 'g', 'm', GeomFromText('POINT(31 119)')),
('p', 'c', 'f', GeomFromText('POINT(17 221)')),
('t', 'h', 'k', GeomFromText('POINT(26 203)')),
('u', 'w', 'p', GeomFromText('POINT(47 185)')),
('z', 'a', 'c', GeomFromText('POINT(61 133)')),
('u', 'k', 'a', GeomFromText('POINT(210 115)')),
('k', 'f', 'h', GeomFromText('POINT(125 113)')),
('t', 'v', 'y', GeomFromText('POINT(12 239)')),
('u', 'v', 'd', GeomFromText('POINT(90 24)')),
('m', 'y', 'w', GeomFromText('POINT(25 243)')),
('d', 'n', 'g', GeomFromText('POINT(122 92)')),
('z', 'm', 'f', GeomFromText('POINT(235 110)')),
('q', 'd', 'f', GeomFromText('POINT(233 217)')),
('a', 'v', 'u', GeomFromText('POINT(69 59)')),
('x', 'k', 'p', GeomFromText('POINT(240 14)')),
('i', 'v', 'r', GeomFromText('POINT(154 42)')),
('w', 'h', 'l', GeomFromText('POINT(178 156)')),
('d', 'h', 'n', GeomFromText('POINT(65 157)')),
('c', 'k', 'z', GeomFromText('POINT(62 33)')),
('e', 'l', 'w', GeomFromText('POINT(162 1)')),
('r', 'f', 'i', GeomFromText('POINT(127 71)')),
('q', 'm', 'c', GeomFromText('POINT(63 118)')),
('c', 'h', 'u', GeomFromText('POINT(205 203)')),
('d', 't', 'p', GeomFromText('POINT(234 87)')),
('s', 'g', 'h', GeomFromText('POINT(149 34)')),
('o', 'b', 'q', GeomFromText('POINT(159 179)')),
('k', 'u', 'f', GeomFromText('POINT(202 254)')),
('u', 'f', 'g', GeomFromText('POINT(70 15)')),
('x', 's', 'b', GeomFromText('POINT(25 181)')),
('s', 'c', 'g', GeomFromText('POINT(252 17)')),
('a', 'c', 'f', GeomFromText('POINT(89 67)')),
('r', 'e', 'q', GeomFromText('POINT(55 54)')),
('f', 'i', 'k', GeomFromText('POINT(178 230)')),
('p', 'e', 'l', GeomFromText('POINT(198 28)')),
('w', 'o', 'd', GeomFromText('POINT(204 189)')),
('c', 'a', 'g', GeomFromText('POINT(230 178)')),
('r', 'o', 'e', GeomFromText('POINT(61 116)')),
('w', 'a', 'a', GeomFromText('POINT(178 237)')),
('v', 'd', 'e', GeomFromText('POINT(70 85)')),
('k', 'c', 'e', GeomFromText('POINT(147 118)')),
('d', 'q', 't', GeomFromText('POINT(218 77)')),
('k', 'g', 'f', GeomFromText('POINT(192 113)')),
('w', 'n', 'e', GeomFromText('POINT(92 124)')),
('r', 'm', 'q', GeomFromText('POINT(130 65)')),
('o', 'r', 'r', GeomFromText('POINT(174 233)')),
('k', 'n', 't', GeomFromText('POINT(175 147)')),
('q', 'm', 'r', GeomFromText('POINT(18 208)')),
('l', 'd', 'i', GeomFromText('POINT(13 104)')),
('w', 'o', 'y', GeomFromText('POINT(207 39)')),
('p', 'u', 'o', GeomFromText('POINT(114 31)')),
('y', 'a', 'p', GeomFromText('POINT(106 59)')),
('a', 'x', 'z', GeomFromText('POINT(17 57)')),
('v', 'h', 'x', GeomFromText('POINT(170 13)')),
('t', 's', 'u', GeomFromText('POINT(84 18)')),
('z', 'z', 'f', GeomFromText('POINT(250 197)')),
('l', 'z', 't', GeomFromText('POINT(59 80)')),
('j', 'g', 's', GeomFromText('POINT(54 26)')),
('g', 'v', 'm', GeomFromText('POINT(89 98)')),
('q', 'v', 'b', GeomFromText('POINT(39 240)')),
('x', 'k', 'v', GeomFromText('POINT(246 207)')),
('k', 'u', 'i', GeomFromText('POINT(105 111)')),
('w', 'z', 's', GeomFromText('POINT(235 8)')),
('d', 'd', 'd', GeomFromText('POINT(105 4)')),
('c', 'z', 'q', GeomFromText('POINT(13 140)')),
('m', 'k', 'i', GeomFromText('POINT(208 120)')),
('g', 'a', 'g', GeomFromText('POINT(9 182)')),
('z', 'j', 'r', GeomFromText('POINT(149 153)')),
('h', 'f', 'g', GeomFromText('POINT(81 236)')),
('m', 'e', 'q', GeomFromText('POINT(209 215)')),
('c', 'h', 'y', GeomFromText('POINT(235 70)')),
('i', 'e', 'g', GeomFromText('POINT(138 26)')),
('m', 't', 'u', GeomFromText('POINT(119 237)')),
('o', 'w', 's', GeomFromText('POINT(193 166)')),
('f', 'm', 'q', GeomFromText('POINT(85 96)')),
('x', 'l', 'x', GeomFromText('POINT(58 115)')),
('x', 'q', 'u', GeomFromText('POINT(108 210)')),
('b', 'h', 'i', GeomFromText('POINT(250 139)')),
('y', 'd', 'x', GeomFromText('POINT(199 135)')),
('w', 'h', 'p', GeomFromText('POINT(247 233)')),
('p', 'z', 't', GeomFromText('POINT(148 249)')),
('q', 'a', 'u', GeomFromText('POINT(174 78)')),
('v', 't', 'm', GeomFromText('POINT(70 228)')),
('t', 'n', 'f', GeomFromText('POINT(123 2)')),
('x', 't', 'b', GeomFromText('POINT(35 50)')),
('r', 'j', 'f', GeomFromText('POINT(200 51)')),
('s', 'q', 'o', GeomFromText('POINT(23 184)')),
('u', 'v', 'z', GeomFromText('POINT(7 113)')),
('v', 'u', 'l', GeomFromText('POINT(145 190)')),
('o', 'k', 'i', GeomFromText('POINT(161 122)')),
('l', 'y', 'e', GeomFromText('POINT(17 232)')),
('t', 'b', 'e', GeomFromText('POINT(120 50)')),
('e', 's', 'u', GeomFromText('POINT(254 1)')),
('d', 'd', 'u', GeomFromText('POINT(167 140)')),
('o', 'b', 'x', GeomFromText('POINT(186 237)')),
('m', 's', 's', GeomFromText('POINT(172 149)')),
('t', 'y', 'a', GeomFromText('POINT(149 85)')),
('x', 't', 'r', GeomFromText('POINT(10 165)')),
('g', 'c', 'e', GeomFromText('POINT(95 165)')),
('e', 'e', 'z', GeomFromText('POINT(98 65)')),
('f', 'v', 'i', GeomFromText('POINT(149 144)')),
('o', 'p', 'm', GeomFromText('POINT(233 67)')),
('t', 'u', 'b', GeomFromText('POINT(109 215)')),
('o', 'o', 'b', GeomFromText('POINT(130 48)')),
('e', 'm', 'h', GeomFromText('POINT(88 189)')),
('e', 'v', 'y', GeomFromText('POINT(55 29)')),
('e', 't', 'm', GeomFromText('POINT(129 55)')),
('p', 'p', 'i', GeomFromText('POINT(126 222)')),
('c', 'i', 'c', GeomFromText('POINT(19 158)')),
('c', 'b', 's', GeomFromText('POINT(13 19)')),
('u', 'y', 'a', GeomFromText('POINT(114 5)')),
('a', 'o', 'f', GeomFromText('POINT(227 232)')),
('t', 'c', 'z', GeomFromText('POINT(63 62)')),
('d', 'o', 'k', GeomFromText('POINT(48 228)')),
('x', 'c', 'e', GeomFromText('POINT(204 2)')),
('e', 'e', 'g', GeomFromText('POINT(125 43)')),
('o', 'r', 'f', GeomFromText('POINT(171 140)'));
UPDATE t1 set spatial_point=GeomFromText('POINT(163 157)') where c1 like 'w%';
UPDATE t1 set spatial_point=GeomFromText('POINT(53 151)') where c1 like 'd%';
UPDATE t1 set spatial_point=GeomFromText('POINT(96 183)') where c1 like 'r%';
UPDATE t1 set spatial_point=GeomFromText('POINT(57 91)') where c1 like 'q%';
UPDATE t1 set spatial_point=GeomFromText('POINT(202 110)') where c1 like 'c%';
UPDATE t1 set spatial_point=GeomFromText('POINT(120 137)') where c1 like 'w%';
UPDATE t1 set spatial_point=GeomFromText('POINT(207 147)') where c1 like 'c%';
UPDATE t1 set spatial_point=GeomFromText('POINT(31 125)') where c1 like 'e%';
UPDATE t1 set spatial_point=GeomFromText('POINT(27 36)') where c1 like 'r%';
INSERT INTO t1 (c2, c1, c3, spatial_point) VALUES
('b', 'c', 'e', GeomFromText('POINT(41 137)')),
('p', 'y', 'k', GeomFromText('POINT(50 22)')),
('s', 'c', 'h', GeomFromText('POINT(208 173)')),
('x', 'u', 'l', GeomFromText('POINT(199 175)')),
('s', 'r', 'h', GeomFromText('POINT(85 192)')),
('j', 'k', 'u', GeomFromText('POINT(18 25)')),
('p', 'w', 'h', GeomFromText('POINT(152 197)')),
('e', 'd', 'c', GeomFromText('POINT(229 3)')),
('o', 'x', 'k', GeomFromText('POINT(187 155)')),
('o', 'b', 'k', GeomFromText('POINT(208 150)')),
('d', 'a', 'j', GeomFromText('POINT(70 87)')),
('f', 'e', 'k', GeomFromText('POINT(156 96)')),
('u', 'y', 'p', GeomFromText('POINT(239 193)')),
('n', 'v', 'p', GeomFromText('POINT(223 98)')),
('z', 'j', 'r', GeomFromText('POINT(87 89)')),
('h', 'x', 'x', GeomFromText('POINT(92 0)')),
('r', 'v', 'r', GeomFromText('POINT(159 139)')),
('v', 'g', 'g', GeomFromText('POINT(16 229)')),
('z', 'k', 'u', GeomFromText('POINT(99 52)')),
('p', 'p', 'o', GeomFromText('POINT(105 125)')),
('w', 'h', 'y', GeomFromText('POINT(105 154)')),
('v', 'y', 'z', GeomFromText('POINT(134 238)')),
('x', 'o', 'o', GeomFromText('POINT(178 88)')),
('z', 'w', 'd', GeomFromText('POINT(123 60)')),
('q', 'f', 'u', GeomFromText('POINT(64 90)')),
('s', 'n', 't', GeomFromText('POINT(50 138)')),
('v', 'p', 't', GeomFromText('POINT(114 91)')),
('a', 'o', 'n', GeomFromText('POINT(78 43)')),
('k', 'u', 'd', GeomFromText('POINT(185 161)')),
('w', 'd', 'n', GeomFromText('POINT(25 92)')),
('k', 'w', 'a', GeomFromText('POINT(59 238)')),
('t', 'c', 'f', GeomFromText('POINT(65 87)')),
('g', 's', 'p', GeomFromText('POINT(238 126)')),
('d', 'n', 'y', GeomFromText('POINT(107 173)')),
('l', 'a', 'w', GeomFromText('POINT(125 152)')),
('m', 'd', 'j', GeomFromText('POINT(146 53)')),
('q', 'm', 'c', GeomFromText('POINT(217 187)')),
('i', 'r', 'r', GeomFromText('POINT(6 113)')),
('e', 'j', 'b', GeomFromText('POINT(37 83)')),
('w', 'w', 'h', GeomFromText('POINT(83 199)')),
('k', 'b', 's', GeomFromText('POINT(170 64)')),
('s', 'b', 'c', GeomFromText('POINT(163 130)')),
('c', 'h', 'a', GeomFromText('POINT(141 3)')),
('k', 'j', 'u', GeomFromText('POINT(143 76)')),
('r', 'h', 'o', GeomFromText('POINT(243 92)')),
('i', 'd', 'b', GeomFromText('POINT(205 13)')),
('r', 'y', 'q', GeomFromText('POINT(138 8)')),
('m', 'o', 'i', GeomFromText('POINT(36 45)')),
('v', 'g', 'm', GeomFromText('POINT(0 40)')),
('f', 'e', 'i', GeomFromText('POINT(76 6)')),
('c', 'q', 'q', GeomFromText('POINT(115 248)')),
('x', 'c', 'i', GeomFromText('POINT(29 74)')),
('l', 's', 't', GeomFromText('POINT(83 18)')),
('t', 't', 'a', GeomFromText('POINT(26 168)')),
('u', 'n', 'x', GeomFromText('POINT(200 110)')),
('j', 'b', 'd', GeomFromText('POINT(216 136)')),
('s', 'p', 'w', GeomFromText('POINT(38 156)')),
('f', 'b', 'v', GeomFromText('POINT(29 186)')),
('v', 'e', 'r', GeomFromText('POINT(149 40)')),
('v', 't', 'm', GeomFromText('POINT(184 24)')),
('y', 'g', 'a', GeomFromText('POINT(219 105)')),
('s', 'f', 'i', GeomFromText('POINT(114 130)')),
('e', 'q', 'h', GeomFromText('POINT(203 135)')),
('h', 'g', 'b', GeomFromText('POINT(9 208)')),
('o', 'l', 'r', GeomFromText('POINT(245 79)')),
('s', 's', 'v', GeomFromText('POINT(238 198)')),
('w', 'w', 'z', GeomFromText('POINT(209 232)')),
('v', 'd', 'n', GeomFromText('POINT(30 193)')),
('q', 'w', 'k', GeomFromText('POINT(133 18)')),
('o', 'h', 'o', GeomFromText('POINT(42 140)')),
('f', 'f', 'h', GeomFromText('POINT(145 1)')),
('u', 's', 'r', GeomFromText('POINT(70 62)')),
('x', 'n', 'q', GeomFromText('POINT(33 86)')),
('u', 'p', 'v', GeomFromText('POINT(232 220)')),
('z', 'e', 'a', GeomFromText('POINT(130 69)')),
('r', 'u', 'z', GeomFromText('POINT(243 241)')),
('b', 'n', 't', GeomFromText('POINT(120 12)')),
('u', 'f', 's', GeomFromText('POINT(190 212)')),
('a', 'd', 'q', GeomFromText('POINT(235 191)')),
('f', 'q', 'm', GeomFromText('POINT(176 2)')),
('n', 'c', 's', GeomFromText('POINT(218 163)')),
('e', 'm', 'h', GeomFromText('POINT(163 108)')),
('c', 'f', 'l', GeomFromText('POINT(220 115)')),
('c', 'v', 'q', GeomFromText('POINT(66 45)')),
('w', 'v', 'x', GeomFromText('POINT(251 220)')),
('f', 'w', 'z', GeomFromText('POINT(146 149)')),
('h', 'n', 'h', GeomFromText('POINT(148 128)')),
('y', 'k', 'v', GeomFromText('POINT(28 110)')),
('c', 'x', 'q', GeomFromText('POINT(13 13)')),
('e', 'd', 's', GeomFromText('POINT(91 190)')),
('c', 'w', 'c', GeomFromText('POINT(10 231)')),
('u', 'j', 'n', GeomFromText('POINT(250 21)')),
('w', 'n', 'x', GeomFromText('POINT(141 69)')),
('f', 'p', 'y', GeomFromText('POINT(228 246)')),
('d', 'q', 'f', GeomFromText('POINT(194 22)')),
('d', 'z', 'l', GeomFromText('POINT(233 181)')),
('c', 'a', 'q', GeomFromText('POINT(183 96)')),
('m', 'i', 'd', GeomFromText('POINT(117 226)')),
('z', 'y', 'y', GeomFromText('POINT(62 81)')),
('g', 'v', 'm', GeomFromText('POINT(66 158)'));
SET @@RAND_SEED1=481064922, @@RAND_SEED2=438133497;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
SET @@RAND_SEED1=280535103, @@RAND_SEED2=444518646;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
SET @@RAND_SEED1=1072017234, @@RAND_SEED2=484203885;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
SET @@RAND_SEED1=358851897, @@RAND_SEED2=358495224;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
SET @@RAND_SEED1=509031459, @@RAND_SEED2=675962925;
DELETE FROM t1 ORDER BY RAND() LIMIT 10;
UPDATE t1 set spatial_point=GeomFromText('POINT(61 203)') where c1 like 'y%';
UPDATE t1 set spatial_point=GeomFromText('POINT(202 194)') where c1 like 'f%';
UPDATE t1 set spatial_point=GeomFromText('POINT(228 18)') where c1 like 'h%';
UPDATE t1 set spatial_point=GeomFromText('POINT(88 18)') where c1 like 'l%';
UPDATE t1 set spatial_point=GeomFromText('POINT(176 94)') where c1 like 'e%';
UPDATE t1 set spatial_point=GeomFromText('POINT(44 47)') where c1 like 'g%';
UPDATE t1 set spatial_point=GeomFromText('POINT(95 191)') where c1 like 'b%';
UPDATE t1 set spatial_point=GeomFromText('POINT(179 218)') where c1 like 'y%';
UPDATE t1 set spatial_point=GeomFromText('POINT(239 40)') where c1 like 'g%';
UPDATE t1 set spatial_point=GeomFromText('POINT(248 41)') where c1 like 'q%';
UPDATE t1 set spatial_point=GeomFromText('POINT(167 82)') where c1 like 't%';
UPDATE t1 set spatial_point=GeomFromText('POINT(13 104)') where c1 like 'u%';
UPDATE t1 set spatial_point=GeomFromText('POINT(139 84)') where c1 like 'a%';
UPDATE t1 set spatial_point=GeomFromText('POINT(145 108)') where c1 like 'p%';
UPDATE t1 set spatial_point=GeomFromText('POINT(147 57)') where c1 like 't%';
UPDATE t1 set spatial_point=GeomFromText('POINT(217 144)') where c1 like 'n%';
UPDATE t1 set spatial_point=GeomFromText('POINT(160 224)') where c1 like 'w%';
UPDATE t1 set spatial_point=GeomFromText('POINT(38 28)') where c1 like 'j%';
UPDATE t1 set spatial_point=GeomFromText('POINT(104 114)') where c1 like 'q%';
UPDATE t1 set spatial_point=GeomFromText('POINT(88 19)') where c1 like 'c%';
INSERT INTO t1 (c2, c1, c3, spatial_point) VALUES
('f', 'x', 'p', GeomFromText('POINT(92 181)')),
('s', 'i', 'c', GeomFromText('POINT(49 60)')),
('c', 'c', 'i', GeomFromText('POINT(7 57)')),
('n', 'g', 'k', GeomFromText('POINT(252 105)')),
('g', 'b', 'm', GeomFromText('POINT(180 11)')),
('u', 'l', 'r', GeomFromText('POINT(32 90)')),
('c', 'x', 'e', GeomFromText('POINT(143 24)')),
('x', 'u', 'a', GeomFromText('POINT(123 92)')),
('s', 'b', 'h', GeomFromText('POINT(190 108)')),
('c', 'x', 'b', GeomFromText('POINT(104 100)')),
('i', 'd', 't', GeomFromText('POINT(214 104)')),
('r', 'w', 'g', GeomFromText('POINT(29 67)')),
('b', 'f', 'g', GeomFromText('POINT(149 46)')),
('r', 'r', 'd', GeomFromText('POINT(242 196)')),
('j', 'l', 'a', GeomFromText('POINT(90 196)')),
('e', 't', 'b', GeomFromText('POINT(190 64)')),
('l', 'x', 'w', GeomFromText('POINT(250 73)')),
('q', 'y', 'r', GeomFromText('POINT(120 182)')),
('s', 'j', 'a', GeomFromText('POINT(180 175)')),
('n', 'i', 'y', GeomFromText('POINT(124 136)')),
('s', 'x', 's', GeomFromText('POINT(176 209)')),
('u', 'f', 's', GeomFromText('POINT(215 173)')),
('m', 'j', 'x', GeomFromText('POINT(44 140)')),
('v', 'g', 'x', GeomFromText('POINT(177 233)')),
('u', 't', 'b', GeomFromText('POINT(136 197)')),
('f', 'g', 'b', GeomFromText('POINT(10 8)')),
('v', 'c', 'j', GeomFromText('POINT(13 81)')),
('d', 's', 'q', GeomFromText('POINT(200 100)')),
('a', 'p', 'j', GeomFromText('POINT(33 40)')),
('i', 'c', 'g', GeomFromText('POINT(168 204)')),
('k', 'h', 'i', GeomFromText('POINT(93 243)')),
('s', 'b', 's', GeomFromText('POINT(157 13)')),
('v', 'l', 'l', GeomFromText('POINT(103 6)')),
('r', 'b', 'k', GeomFromText('POINT(244 137)')),
('l', 'd', 'r', GeomFromText('POINT(162 254)')),
('q', 'b', 'z', GeomFromText('POINT(136 246)')),
('x', 'x', 'p', GeomFromText('POINT(120 37)')),
('m', 'e', 'z', GeomFromText('POINT(203 167)')),
('q', 'n', 'p', GeomFromText('POINT(94 119)')),
('b', 'g', 'u', GeomFromText('POINT(93 248)')),
('r', 'v', 'v', GeomFromText('POINT(53 88)')),
('y', 'a', 'i', GeomFromText('POINT(98 219)')),
('a', 's', 'g', GeomFromText('POINT(173 138)')),
('c', 'a', 't', GeomFromText('POINT(235 135)')),
('q', 'm', 'd', GeomFromText('POINT(224 208)')),
('e', 'p', 'k', GeomFromText('POINT(161 238)')),
('n', 'g', 'q', GeomFromText('POINT(35 204)')),
('t', 't', 'x', GeomFromText('POINT(230 178)')),
('w', 'f', 'a', GeomFromText('POINT(150 221)')),
('z', 'm', 'z', GeomFromText('POINT(119 42)')),
('l', 'j', 's', GeomFromText('POINT(97 96)')),
('f', 'z', 'x', GeomFromText('POINT(208 65)')),
('i', 'v', 'c', GeomFromText('POINT(145 79)')),
('l', 'f', 'k', GeomFromText('POINT(83 234)')),
('u', 'a', 's', GeomFromText('POINT(250 49)')),
('o', 'k', 'p', GeomFromText('POINT(46 50)')),
('d', 'e', 'z', GeomFromText('POINT(30 198)')),
('r', 'r', 'l', GeomFromText('POINT(78 189)')),
('y', 'l', 'f', GeomFromText('POINT(188 132)')),
('d', 'q', 'm', GeomFromText('POINT(247 107)')),
('p', 'j', 'n', GeomFromText('POINT(148 227)')),
('b', 'o', 'i', GeomFromText('POINT(172 25)')),
('e', 'v', 'd', GeomFromText('POINT(94 248)')),
('q', 'd', 'f', GeomFromText('POINT(15 29)')),
('w', 'b', 'b', GeomFromText('POINT(74 111)')),
('g', 'q', 'f', GeomFromText('POINT(107 215)')),
('o', 'h', 'r', GeomFromText('POINT(25 168)')),
('u', 't', 'w', GeomFromText('POINT(251 188)')),
('h', 's', 'w', GeomFromText('POINT(254 247)')),
('f', 'f', 'b', GeomFromText('POINT(166 103)'));
SET @@RAND_SEED1=866613816, @@RAND_SEED2=92289615;
INSERT INTO t1 (c2, c1, c3, spatial_point) VALUES
('l', 'c', 'l', GeomFromText('POINT(202 98)')),
('k', 'c', 'b', GeomFromText('POINT(46 206)')),
('r', 'y', 'm', GeomFromText('POINT(74 140)')),
('y', 'z', 'd', GeomFromText('POINT(200 160)')),
('s', 'y', 's', GeomFromText('POINT(156 205)')),
('u', 'v', 'p', GeomFromText('POINT(86 82)')),
('j', 's', 's', GeomFromText('POINT(91 233)')),
('x', 'j', 'f', GeomFromText('POINT(3 14)')),
('l', 'z', 'v', GeomFromText('POINT(123 156)')),
('h', 'i', 'o', GeomFromText('POINT(145 229)')),
('o', 'r', 'd', GeomFromText('POINT(15 22)')),
('f', 'x', 't', GeomFromText('POINT(21 60)')),
('t', 'g', 'h', GeomFromText('POINT(50 153)')),
('g', 'u', 'b', GeomFromText('POINT(82 85)')),
('v', 'a', 'p', GeomFromText('POINT(231 178)')),
('n', 'v', 'o', GeomFromText('POINT(183 25)')),
('j', 'n', 'm', GeomFromText('POINT(50 144)')),
('e', 'f', 'i', GeomFromText('POINT(46 16)')),
('d', 'w', 'a', GeomFromText('POINT(66 6)')),
('f', 'x', 'a', GeomFromText('POINT(107 197)')),
('m', 'o', 'a', GeomFromText('POINT(142 80)')),
('q', 'l', 'g', GeomFromText('POINT(251 23)')),
('c', 's', 's', GeomFromText('POINT(158 43)')),
('y', 'd', 'o', GeomFromText('POINT(196 228)')),
('d', 'p', 'l', GeomFromText('POINT(107 5)')),
('h', 'a', 'b', GeomFromText('POINT(183 166)')),
('m', 'w', 'p', GeomFromText('POINT(19 59)')),
('b', 'y', 'o', GeomFromText('POINT(178 30)')),
('x', 'w', 'i', GeomFromText('POINT(168 94)')),
('t', 'k', 'z', GeomFromText('POINT(171 5)')),
('r', 'm', 'a', GeomFromText('POINT(222 19)')),
('u', 'v', 'e', GeomFromText('POINT(224 80)')),
('q', 'r', 'k', GeomFromText('POINT(212 218)')),
('d', 'p', 'j', GeomFromText('POINT(169 7)')),
('d', 'r', 'v', GeomFromText('POINT(193 23)')),
('n', 'y', 'y', GeomFromText('POINT(130 178)')),
('m', 'z', 'r', GeomFromText('POINT(81 200)')),
('j', 'e', 'w', GeomFromText('POINT(145 239)')),
('v', 'h', 'x', GeomFromText('POINT(24 105)')),
('z', 'm', 'a', GeomFromText('POINT(175 129)')),
('b', 'c', 'v', GeomFromText('POINT(213 10)')),
('t', 't', 'u', GeomFromText('POINT(2 129)')),
('r', 's', 'v', GeomFromText('POINT(209 192)')),
('x', 'p', 'g', GeomFromText('POINT(43 63)')),
('t', 'e', 'u', GeomFromText('POINT(139 210)')),
('l', 'e', 't', GeomFromText('POINT(245 148)')),
('a', 'i', 'k', GeomFromText('POINT(167 195)')),
('m', 'o', 'h', GeomFromText('POINT(206 120)')),
('g', 'z', 's', GeomFromText('POINT(169 240)')),
('z', 'u', 's', GeomFromText('POINT(202 120)')),
('i', 'b', 'a', GeomFromText('POINT(216 18)')),
('w', 'y', 'g', GeomFromText('POINT(119 236)')),
('h', 'y', 'p', GeomFromText('POINT(161 24)'));
UPDATE t1 set spatial_point=GeomFromText('POINT(33 100)') where c1 like 't%';
UPDATE t1 set spatial_point=GeomFromText('POINT(41 46)') where c1 like 'f%';
CHECK TABLE t1 EXTENDED;
DROP TABLE t1;
#
# Bug #30286 spatial index cause corruption and server crash!
#
create table t1 (a geometry not null, spatial index(a)) transactional=1 row_format=page;
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 131072)));
insert into t1 values (PointFromWKB(POINT(9.1248812352444e+192, 2.9740338169556e+284)));
insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, -0)));
insert into t1 values (PointFromWKB(POINT(1.49166814624e-154, 2.0880974297595e-53)));
insert into t1 values (PointFromWKB(POINT(4.0917382598702e+149, 1.2024538023802e+111)));
insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 2.9993936277913e-241)));
insert into t1 values (PointFromWKB(POINT(2.5243548967072e-29, 1.2024538023802e+111)));
insert into t1 values (PointFromWKB(POINT(0, 6.9835074892995e-251)));
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 3.1050361846014e+231)));
insert into t1 values (PointFromWKB(POINT(2.8728483499323e-188, 2.4600631144627e+260)));
insert into t1 values (PointFromWKB(POINT(3.0517578125e-05, 2.0349165139404e+236)));
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 1.1818212630766e-125)));
insert into t1 values (PointFromWKB(POINT(2.481040258324e-265, 5.7766220027675e-275)));
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 2.5243548967072e-29)));
insert into t1 values (PointFromWKB(POINT(5.7766220027675e-275, 9.9464647281957e+86)));
insert into t1 values (PointFromWKB(POINT(2.2181357552967e+130, 3.7857669957337e-270)));
insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.6893488147419e+19)));
insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.7537584144024e+255)));
insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 1.8033161362863e-130)));
insert into t1 values (PointFromWKB(POINT(0, 5.8774717541114e-39)));
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 2.2761049594727e-159)));
insert into t1 values (PointFromWKB(POINT(6.243497100632e+144, 3.7857669957337e-270)));
insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 2.6355494858076e-82)));
insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 3.8518598887745e-34)));
insert into t1 values (PointFromWKB(POINT(4.6566128730774e-10, 2.0880974297595e-53)));
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 1.8827498946116e-183)));
insert into t1 values (PointFromWKB(POINT(1.8033161362863e-130, 9.1248812352444e+192)));
insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, 2.2761049594727e-159)));
insert into t1 values (PointFromWKB(POINT(1.94906280228e+289, 1.2338789709327e-178)));
drop table t1;
# End of 4.1 tests
#
# bug #21790 (UNKNOWN ERROR on NULLs in RTree)
#
CREATE TABLE t1(foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) ) transactional=1 row_format=page;
--error 1048
INSERT INTO t1(foo) VALUES (NULL);
--error 1416
INSERT INTO t1() VALUES ();
--error 1416
INSERT INTO t1(foo) VALUES ('');
DROP TABLE t1;
#
# Bug #23578: Corruption prevents Optimize table from working properly with a
# spatial index
#
CREATE TABLE t1 (a INT AUTO_INCREMENT, b POINT NOT NULL, KEY (a), SPATIAL KEY (b)) transactional=1 row_format=page;
INSERT INTO t1 (b) VALUES (GeomFromText('POINT(1 2)'));
INSERT INTO t1 (b) SELECT b FROM t1;
INSERT INTO t1 (b) SELECT b FROM t1;
INSERT INTO t1 (b) SELECT b FROM t1;
INSERT INTO t1 (b) SELECT b FROM t1;
INSERT INTO t1 (b) SELECT b FROM t1;
OPTIMIZE TABLE t1;
DROP TABLE t1;
#
# Bug #29070: Error in spatial index
#
CREATE TABLE t1 (a INT, b GEOMETRY NOT NULL, SPATIAL KEY b(b)) transactional=1 row_format=page;
INSERT INTO t1 VALUES (1, GEOMFROMTEXT('LINESTRING(1102218.456 1,2000000 2)'));
INSERT INTO t1 VALUES (2, GEOMFROMTEXT('LINESTRING(1102218.456 1,2000000 2)'));
# must return the same number as the next select
SELECT COUNT(*) FROM t1 WHERE
MBRINTERSECTS(b, GEOMFROMTEXT('LINESTRING(1 1,1102219 2)') );
SELECT COUNT(*) FROM t1 IGNORE INDEX (b) WHERE
MBRINTERSECTS(b, GEOMFROMTEXT('LINESTRING(1 1,1102219 2)') );
DROP TABLE t1;
--echo End of 5.0 tests.
--skip-stack-trace --skip-core-file
# Test of Recovery of R-tree (table t1) and fulltext (table t2) indices
--source include/not_embedded.inc
# Don't test this under valgrind, memory leaks will occur as we crash
--source include/not_valgrind.inc
# Binary must be compiled with debug for crash to occur
--source include/have_debug.inc
--source include/have_maria.inc
set global maria_log_file_size=4294967295;
let $MARIA_LOG=.;
--disable_warnings
drop database if exists mysqltest;
--enable_warnings
create database mysqltest;
# Include scripts can perform SQL. For it to not influence the main test
# they use a separate connection. This way if they use a DDL it would
# not autocommit in the main test.
connect (admin, 127.0.0.1, root,,mysqltest,,);
--enable_reconnect
connection default;
use mysqltest;
--enable_reconnect
-- source include/maria_empty_logs.inc
let $mms_tables=2;
CREATE TABLE t1 (
line LINESTRING NOT NULL,
kind ENUM('po', 'pp', 'rr', 'dr', 'rd', 'ts', 'cl') NOT NULL DEFAULT 'po',
name VARCHAR(32)
,SPATIAL key (line)
) transactional=1 row_format=page engine=maria;
SHOW INDEX FROM t1;
CREATE TABLE t2 (a VARCHAR(200), b TEXT, FULLTEXT (a,b)
) transactional=1 row_format=page engine=maria;
SHOW INDEX FROM t2;
let $query1= INSERT INTO t1 (name, kind, line) VALUES
("Aadaouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
("Aadassiye", "pp", GeomFromText("POINT(35.816667 36.216667)")),
("Aadbel", "pp", GeomFromText("POINT(34.533333 36.100000)")),
("Aadchit", "pp", GeomFromText("POINT(33.347222 35.423611)")),
("Aadchite", "pp", GeomFromText("POINT(33.347222 35.423611)")),
("Aadchit el Qoussair", "pp", GeomFromText("POINT(33.283333 35.483333)")),
("Aaddaye", "pp", GeomFromText("POINT(36.716667 40.833333)")),
("'Aadeissa", "pp", GeomFromText("POINT(32.823889 35.698889)")),
("Aaderup", "pp", GeomFromText("POINT(55.216667 11.766667)")),
("Qalaat Aades", "pp", GeomFromText("POINT(33.503333 35.377500)")),
("A ad'ino", "pp", GeomFromText("POINT(54.812222 38.209167)")),
("Aadi Noia", "pp", GeomFromText("POINT(13.800000 39.833333)")),
("Aad La Macta", "pp", GeomFromText("POINT(35.779444 -0.129167)")),
("Aadland", "pp", GeomFromText("POINT(60.366667 5.483333)")),
("Aadliye", "pp", GeomFromText("POINT(33.366667 36.333333)")),
("Aadloun", "pp", GeomFromText("POINT(33.403889 35.273889)")),
("Aadma", "pp", GeomFromText("POINT(58.798333 22.663889)")),
("Aadma Asundus", "pp", GeomFromText("POINT(58.798333 22.663889)")),
("Aadmoun", "pp", GeomFromText("POINT(34.150000 35.650000)")),
("Aadneram", "pp", GeomFromText("POINT(59.016667 6.933333)")),
("Aadneskaar", "pp", GeomFromText("POINT(58.083333 6.983333)")),
("Aadorf", "pp", GeomFromText("POINT(47.483333 8.900000)")),
("Aadorp", "pp", GeomFromText("POINT(52.366667 6.633333)")),
("Aadouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
("Aadoui", "pp", GeomFromText("POINT(34.450000 35.983333)")),
("Aadouiye", "pp", GeomFromText("POINT(34.583333 36.183333)")),
("Aadouss", "pp", GeomFromText("POINT(33.512500 35.601389)")),
("Aadra", "pp", GeomFromText("POINT(33.616667 36.500000)")),
("Aadzi", "pp", GeomFromText("POINT(38.100000 64.850000)"));
let $query2= INSERT INTO t2 VALUES
('MySQL has now support', 'for full-text search'),
('Full-text indexes', 'are called collections'),
('Only MyISAM tables','support collections'),
('Function MATCH ... AGAINST()','is used to do a search'),
('Full-text search in MySQL', 'implements vector space model'),
('We want to see', 'if this is recoverable'),
('Or rather leaves a bad corrupted table', 'after a crash'),
('Test of REDOs', 'and then UNDOs'),
('Recovery is interesting', 'but sometimes complicated'),
('But what if it was simple', 'and boring?'),
('I wish I knew more', 'about how fulltext works'),
('Maybe I should read about it', 'on the Internet');
--echo * TEST of REDO: see if recovery can reconstruct if we give it an old table
-- source include/maria_make_snapshot_for_feeding_recovery.inc
--disable_query_log
let $1=120; # 8 is smallest value to cause root split; 12 for child split
while($1)
{
eval $query1;
eval $query2;
dec $1;
}
let $1=120;
while($1)
{
delete from t1 limit 1;
delete from t1 limit 10;
delete from t1 limit 7;
delete from t1 limit 2;
delete from t2 limit 6;
dec $1;
}
--enable_query_log
-- source include/maria_make_snapshot_for_comparison.inc
# we want recovery to run on the first snapshot made above
let $mvr_restore_old_snapshot=1;
let $mms_compare_physically=0;
let $mvr_debug_option="+d,maria_flush_whole_log,maria_crash";
let $mvr_crash_statement= set global maria_checkpoint_interval=1;
# the script below will trigger recovery and compare checksums
-- source include/maria_verify_recovery.inc
# Test of REDO + UNDO
--echo * TEST of INSERT and DELETE's rollback
# different types of crash => a loop; here are loop control variables
let $crash_no_flush=1;
let $crash_flush_whole_page_cache=0;
let $crash_flush_states=0;
let $crash_flush_whole_log=0;
let $crash_loop=1;
# we want recovery to use the tables as they were at time of crash
let $mvr_restore_old_snapshot=0;
# UNDO phase prevents physical comparison, normally,
# so we'll only use checksums to compare.
let $mms_compare_physically=0;
let $mvr_crash_statement= set global maria_checkpoint_interval=1;
# Note that we don't remove logs between iterations. Test is
# cumulative (each new recovery processes more log records than the previous).
while ($crash_loop)
{
if ($crash_flush_whole_log)
{
let $mvr_debug_option="+d,maria_flush_whole_log,maria_crash";
# set up what next iteration should do:
let $crash_flush_whole_log=0;
let $crash_loop=0;
}
if ($crash_flush_states)
{
let $mvr_debug_option="+d,maria_flush_states,maria_flush_whole_log,maria_crash";
let $crash_flush_states=0;
let $crash_flush_whole_log=1;
}
if ($crash_flush_whole_page_cache)
{
let $mvr_debug_option="+d,maria_flush_whole_page_cache,maria_crash";
let $crash_flush_whole_page_cache=0;
let $crash_flush_states=1;
}
if ($crash_no_flush)
{
let $mvr_debug_option="+d,maria_crash";
let $crash_no_flush=0;
let $crash_flush_whole_page_cache=1;
}
# Your committed statements here
-- source include/maria_make_snapshot_for_comparison.inc
# Your statements which we expect to be rolled back
lock tables t1 write, t2 write;
--disable_query_log
let $1=120;
while($1)
{
eval $query1;
eval $query2;
dec $1;
}
let $1=120;
while($1)
{
delete from t1 limit 1;
delete from t1 limit 10;
delete from t1 limit 7;
delete from t1 limit 2;
delete from t2 limit 6;
dec $1;
}
--enable_query_log
-- source include/maria_verify_recovery.inc
}
# Finally check when we make the table empty
# This is currently hitting BUG#36319
-- source include/maria_make_snapshot_for_comparison.inc
lock tables t1 write, t2 write;
select count(*) from t1;
delete from t1;
select count(*) from t1;
select count(*) from t2;
delete from t2;
select count(*) from t2;
-- source include/maria_verify_recovery.inc
drop table t1,t2;
......@@ -1410,18 +1410,6 @@ create table t1 (a int);
show create table t1;
drop table t1;
#
# Show that we can't yet create fulltext or spatial index with Maria
#
--error 138
create table t1 (s varchar(25), fulltext(s)) TRANSACTIONAL= 1;
drop table if exists t1;
--error 138
create table t1 ( fid int not null auto_increment primary key,
g geometry not null, spatial key(g));
drop table if exists t1;
#
# Test warning on log file size truncates
#
......
......@@ -3812,9 +3812,6 @@ static int delete_dir_entry(uchar *buff, uint block_size, uint record_number,
leave the page as write locked as we may put
the new row into the old position.
NOTES
Uses info->keyread_buff
RETURN
0 ok
1 error
......@@ -3934,9 +3931,6 @@ static my_bool delete_head_or_tail(MARIA_HA *info,
info Handler
tails Pointer to vector of tail positions, ending with 0
NOTES
Uses info->keyread_buff
RETURN
0 ok
1 error
......@@ -5211,9 +5205,9 @@ uint ma_calc_length_for_store_length(ulong nr)
/* Retrive a stored number */
static ulong ma_get_length(uchar **packet)
static ulong ma_get_length(const uchar **packet)
{
reg1 uchar *pos= *packet;
reg1 const uchar *pos= *packet;
if (*pos < 251)
{
(*packet)++;
......@@ -6031,7 +6025,7 @@ uint _ma_apply_redo_purge_row_head_or_tail(MARIA_HA *info, LSN lsn,
pgcache_page_no_t page;
uint rownr, empty_space;
uint block_size= share->block_size;
uchar *buff= info->keyread_buff;
uchar *buff;
int result;
uint error;
MARIA_PINNED_PAGE page_link;
......@@ -6558,7 +6552,7 @@ my_bool _ma_apply_undo_row_delete(MARIA_HA *info, LSN undo_lsn,
header+= 2 + row.field_lengths_length;
}
if (share->base.blobs)
row.blob_length= ma_get_length(&header);
row.blob_length= ma_get_length((const uchar**)&header);
/* We need to build up a record (without blobs) in rec_buff */
if (!(record= my_malloc(share->base.reclength, MYF(MY_WME))))
......@@ -6739,8 +6733,7 @@ my_bool _ma_apply_undo_row_update(MARIA_HA *info, LSN undo_lsn,
{
MARIA_SHARE *share= info->s;
MARIA_RECORD_POS record_pos;
uchar *field_length_data;
const uchar *field_length_data_end, *extent_info;
const uchar *field_length_data, *field_length_data_end, *extent_info;
uchar *current_record, *orig_record;
pgcache_page_no_t page;
ha_checksum checksum_delta;
......@@ -6773,7 +6766,7 @@ my_bool _ma_apply_undo_row_update(MARIA_HA *info, LSN undo_lsn,
Set header to point to old field values, generated by
fill_update_undo_parts()
*/
field_length_header= ma_get_length(&header);
field_length_header= ma_get_length((const uchar**)&header);
field_length_data= header;
header+= field_length_header;
field_length_data_end= header;
......
......@@ -4442,7 +4442,16 @@ static int sort_get_next_record(MARIA_SORT_PARAM *sort_param)
for (;;)
{
int flag;
/*
Assume table is transactional and it had LSN pages in the
cache. Repair has flushed them, left data pages stay in
cache, and disabled transactionality (so share's current page
type is PLAIN); page cache would assert if it finds a cached LSN page
while _ma_scan_block_record() requested a PLAIN page. So we use
UNKNOWN.
*/
enum pagecache_page_type save_page_type= share->page_type;
share->page_type= PAGECACHE_READ_UNKNOWN_PAGE;
if (info != sort_info->new_info)
{
/* Safe scanning */
......@@ -4459,6 +4468,7 @@ static int sort_get_next_record(MARIA_SORT_PARAM *sort_param)
flag= _ma_scan_block_record(info, sort_param->record,
info->cur_row.nextpos, 1);
}
share->page_type= save_page_type;
if (!flag)
{
if (sort_param->calc_checksum)
......
......@@ -393,16 +393,6 @@ int maria_create(const char *name, enum data_file_type datafile_type,
length= real_length_diff= 0;
min_key_length= key_length= pointer;
if ((keydef->flag & (HA_SPATIAL | HA_FULLTEXT) &&
ci->transactional))
{
my_errno= HA_ERR_UNSUPPORTED;
my_message(HA_ERR_UNSUPPORTED,
"Maria can't yet handle SPATIAL or FULLTEXT keys in "
"transactional mode. For now use TRANSACTIONAL=0", MYF(0));
goto err_no_lock;
}
if (keydef->flag & HA_SPATIAL)
{
#ifdef HAVE_SPATIAL
......
......@@ -33,9 +33,6 @@ static int underflow(MARIA_HA *info,MARIA_KEYDEF *keyinfo,
static uint remove_key(MARIA_KEYDEF *keyinfo,uint nod_flag,uchar *keypos,
uchar *lastkey,uchar *page_end,
my_off_t *next_block, MARIA_KEY_PARAM *s_temp);
static my_bool _ma_log_delete(MARIA_HA *info, my_off_t page, uchar *buff,
uchar *key_pos, uint changed_length,
uint move_length);
/* @breif Remove a row from a MARIA table */
......@@ -177,58 +174,8 @@ int _ma_ck_delete(register MARIA_HA *info, uint keynr, uchar *key,
&new_root);
if (!res && share->now_transactional)
{
uchar log_data[LSN_STORE_SIZE + FILEID_STORE_SIZE +
KEY_NR_STORE_SIZE + PAGE_STORE_SIZE], *log_pos;
LEX_CUSTRING log_array[TRANSLOG_INTERNAL_PARTS + 2];
struct st_msg_to_write_hook_for_undo_key msg;
enum translog_record_type log_type= LOGREC_UNDO_KEY_DELETE;
info->key_delete_undo_lsn[keynr]= info->trn->undo_lsn;
lsn_store(log_data, info->trn->undo_lsn);
key_nr_store(log_data + LSN_STORE_SIZE + FILEID_STORE_SIZE, keynr);
log_pos= log_data + LSN_STORE_SIZE + FILEID_STORE_SIZE + KEY_NR_STORE_SIZE;
if (new_root != share->state.key_root[keynr])
{
my_off_t page;
page= ((new_root == HA_OFFSET_ERROR) ? IMPOSSIBLE_PAGE_NO :
new_root / share->block_size);
page_store(log_pos, page);
log_pos+= PAGE_STORE_SIZE;
log_type= LOGREC_UNDO_KEY_DELETE_WITH_ROOT;
}
/* Log also position to row */
key_length+= share->rec_reflength;
/*
Note that for delete key, we don't log the reference to the record.
This is because the row may be inserted at a different place when
we exceute the undo
*/
log_array[TRANSLOG_INTERNAL_PARTS + 0].str= log_data;
log_array[TRANSLOG_INTERNAL_PARTS + 0].length= (uint) (log_pos - log_data);
log_array[TRANSLOG_INTERNAL_PARTS + 1].str= key_buff;
log_array[TRANSLOG_INTERNAL_PARTS + 1].length= key_length;
msg.root= &share->state.key_root[keynr];
msg.value= new_root;
/*
set autoincrement to 1 if this is an auto_increment key
This is only used if we are now in a rollback of a duplicate key
*/
msg.auto_increment= share->base.auto_key == keynr + 1;
if (translog_write_record(&lsn, log_type,
info->trn, info,
(translog_size_t)
log_array[TRANSLOG_INTERNAL_PARTS + 0].length +
key_length,
TRANSLOG_INTERNAL_PARTS + 2, log_array,
log_data + LSN_STORE_SIZE, &msg))
res= -1;
}
res= _ma_write_undo_key_delete(info, keynr, key_buff, key_length,
new_root, &lsn);
else
{
share->state.key_root[keynr]= new_root;
......@@ -1371,9 +1318,9 @@ static uint remove_key(MARIA_KEYDEF *keyinfo, uint nod_flag,
*/
static my_bool _ma_log_delete(MARIA_HA *info, my_off_t page, uchar *buff,
uchar *key_pos, uint changed_length,
uint move_length)
my_bool _ma_log_delete(MARIA_HA *info, my_off_t page, const uchar *buff,
const uchar *key_pos, uint changed_length,
uint move_length)
{
LSN lsn;
uchar log_data[FILEID_STORE_SIZE + PAGE_STORE_SIZE + 9 + 7], *log_pos;
......@@ -1436,3 +1383,62 @@ static my_bool _ma_log_delete(MARIA_HA *info, my_off_t page, uchar *buff,
DBUG_RETURN(1);
DBUG_RETURN(0);
}
/****************************************************************************
Logging of undos
****************************************************************************/
int _ma_write_undo_key_delete(MARIA_HA *info, uint keynr,
const uchar *key, uint key_length,
my_off_t new_root, LSN *res_lsn)
{
MARIA_SHARE *share= info->s;
uchar log_data[LSN_STORE_SIZE + FILEID_STORE_SIZE +
KEY_NR_STORE_SIZE + PAGE_STORE_SIZE], *log_pos;
LEX_CUSTRING log_array[TRANSLOG_INTERNAL_PARTS + 2];
struct st_msg_to_write_hook_for_undo_key msg;
enum translog_record_type log_type= LOGREC_UNDO_KEY_DELETE;
info->key_delete_undo_lsn[keynr]= info->trn->undo_lsn;
lsn_store(log_data, info->trn->undo_lsn);
key_nr_store(log_data + LSN_STORE_SIZE + FILEID_STORE_SIZE, keynr);
log_pos= log_data + LSN_STORE_SIZE + FILEID_STORE_SIZE + KEY_NR_STORE_SIZE;
/**
@todo BUG if we had concurrent insert/deletes, reading state's key_root
like this would be unsafe.
*/
if (new_root != share->state.key_root[keynr])
{
my_off_t page;
page= ((new_root == HA_OFFSET_ERROR) ? IMPOSSIBLE_PAGE_NO :
new_root / share->block_size);
page_store(log_pos, page);
log_pos+= PAGE_STORE_SIZE;
log_type= LOGREC_UNDO_KEY_DELETE_WITH_ROOT;
}
/* Log also position to row */
key_length+= share->rec_reflength;
log_array[TRANSLOG_INTERNAL_PARTS + 0].str= log_data;
log_array[TRANSLOG_INTERNAL_PARTS + 0].length= (uint) (log_pos - log_data);
log_array[TRANSLOG_INTERNAL_PARTS + 1].str= key;
log_array[TRANSLOG_INTERNAL_PARTS + 1].length= key_length;
msg.root= &share->state.key_root[keynr];
msg.value= new_root;
/*
set autoincrement to 1 if this is an auto_increment key
This is only used if we are now in a rollback of a duplicate key
*/
msg.auto_increment= share->base.auto_key == keynr + 1;
return translog_write_record(res_lsn, log_type,
info->trn, info,
(translog_size_t)
log_array[TRANSLOG_INTERNAL_PARTS + 0].length +
key_length,
TRANSLOG_INTERNAL_PARTS + 2, log_array,
log_data + LSN_STORE_SIZE, &msg) ? -1 : 0;
}
......@@ -109,7 +109,7 @@ uint _ma_ft_parse(TREE *parsed, MARIA_HA *info, uint keynr, const uchar *record,
{
/** @todo this casts ftsi.pos (const) to non-const */
if (ftsi.pos)
if (maria_ft_parse(parsed, (uchar *)ftsi.pos, ftsi.len, parser, param,
if (maria_ft_parse(parsed, ftsi.pos, ftsi.len, parser, param,
mem_root))
DBUG_RETURN(1);
}
......@@ -335,6 +335,10 @@ uint _ma_ft_convert_to_ft2(MARIA_HA *info, uint keynr, uchar *key)
_ma_store_page_used(share, info->buff, length + share->keypage_header);
memcpy(info->buff + share->keypage_header, key_ptr, length);
info->keyread_buff_used= info->page_changed=1; /* info->buff is used */
/**
@todo RECOVERY BUG this is not logged yet. Ok as this code is never
called, but soon it will be.
*/
if ((root= _ma_new(info, DFLT_INIT_HITS, &page_link)) == HA_OFFSET_ERROR ||
_ma_write_keypage(info, keyinfo, root, page_link->write_lock,
DFLT_INIT_HITS, info->buff))
......
......@@ -19,6 +19,7 @@
#include "ma_blockrec.h"
#include "trnman.h"
#include "ma_key_recover.h"
#include "ma_rt_index.h"
/****************************************************************************
Some helper functions used both by key page loggin and block page loggin
......@@ -202,6 +203,15 @@ my_bool write_hook_for_undo_key(enum translog_record_type type,
(struct st_msg_to_write_hook_for_undo_key *) hook_arg;
*msg->root= msg->value;
/**
@todo BUG
so we have log mutex and then intern_lock.
While in checkpoint we have intern_lock and then log mutex, like when we
flush bitmap (flushing bitmap pages can call hook which takes log mutex).
So we can deadlock.
Another one is that in translog_assign_id_to_share() we have intern_lock
and then log mutex.
*/
_ma_fast_unlock_key_del(tbl_info);
return write_hook_for_undo(type, trn, tbl_info, lsn, 0);
}
......@@ -931,12 +941,49 @@ uint _ma_apply_redo_index(MARIA_HA *info,
crc= uint4korr(header+2);
_ma_store_page_used(share, buff, page_length);
DBUG_ASSERT(check_page_length == page_length);
DBUG_ASSERT(crc == (uint32) my_checksum(0, buff + LSN_STORE_SIZE,
page_length- LSN_STORE_SIZE));
if (crc != (uint32) my_checksum(0, buff + LSN_STORE_SIZE,
page_length - LSN_STORE_SIZE))
{
DBUG_PRINT("info",("page_length %u",page_length));
DBUG_DUMP("KEY_OP_CHECK bad page", buff, share->block_size);
DBUG_ASSERT("crc" == "failure in REDO_INDEX");
}
#endif
header+= 6;
break;
}
case KEY_OP_MULTI_COPY: /* 9 */
{
/*
List of fixed-len memcpy() operations with their source located inside
the page. The log record's piece looks like:
first the length 'full_length' to be used by memcpy()
then the number of bytes used by the list of (to,from) pairs
then the (to,from) pairs, so we do:
for (t,f) in [list of (to,from) pairs]:
memcpy(t, f, full_length).
*/
uint full_length, log_memcpy_length;
const uchar *log_memcpy_end;
full_length= uint2korr(header);
header+= 2;
log_memcpy_length= uint2korr(header);
header+= 2;
log_memcpy_end= header + log_memcpy_length;
DBUG_ASSERT(full_length < share->block_size);
while (header < log_memcpy_end)
{
uint to, from;
to= uint2korr(header);
header+= 2;
from= uint2korr(header);
header+= 2;
/* "from" is a place in the existing page */
DBUG_ASSERT(max(from, to) < share->block_size);
memcpy(buff + to, buff + from, full_length);
}
break;
}
case KEY_OP_NONE:
default:
DBUG_ASSERT(0);
......@@ -1004,8 +1051,11 @@ my_bool _ma_apply_undo_key_insert(MARIA_HA *info, LSN undo_lsn,
DBUG_DUMP("key", key, length);
new_root= share->state.key_root[keynr];
res= _ma_ck_real_delete(info, share->keyinfo+keynr, key,
length - share->rec_reflength, &new_root);
res= (share->keyinfo[keynr].key_alg == HA_KEY_ALG_RTREE) ?
maria_rtree_real_delete(info, keynr, key, length - share->rec_reflength,
&new_root) :
_ma_ck_real_delete(info, share->keyinfo+keynr, key,
length - share->rec_reflength, &new_root);
if (res)
_ma_mark_file_crashed(share);
msg.root= &share->state.key_root[keynr];
......@@ -1055,10 +1105,12 @@ my_bool _ma_apply_undo_key_delete(MARIA_HA *info, LSN undo_lsn,
DBUG_DUMP("key", key, length);
new_root= share->state.key_root[keynr];
res= _ma_ck_real_write_btree(info, share->keyinfo+keynr, key,
length - share->rec_reflength,
&new_root,
share->keyinfo[keynr].write_comp_flag);
res= (share->keyinfo[keynr].key_alg == HA_KEY_ALG_RTREE) ?
maria_rtree_insert_level(info, keynr, key, length - share->rec_reflength,
-1, &new_root) :
_ma_ck_real_write_btree(info, share->keyinfo+keynr, key,
length - share->rec_reflength, &new_root,
share->keyinfo[keynr].write_comp_flag);
if (res)
_ma_mark_file_crashed(share);
......@@ -1089,7 +1141,7 @@ my_bool _ma_apply_undo_key_delete(MARIA_HA *info, LSN undo_lsn,
@param info Maria handler
@param insert_at_end Set to 1 if we are doing an insert
@notes
@note
To allow higher concurrency in the common case where we do inserts
and we don't have any linked blocks we do the following:
- Mark in info->used_key_del that we are not using key_del
......@@ -1106,6 +1158,32 @@ my_bool _ma_lock_key_del(MARIA_HA *info, my_bool insert_at_end)
{
MARIA_SHARE *share= info->s;
/*
info->used_key_del is 0 initially.
If the caller needs a block (_ma_new()), we look at the free list:
- looks empty? then caller will create a new block at end of file and
remember (through info->used_key_del==2) that it will not change
state.key_del and does not need to wake up waiters as nobody will wait for
it.
- non-empty? then we wait for other users of the state.key_del list to
have finished, then we lock this list (through share->used_key_del==1)
because we need to prevent some other thread to also read state.key_del
and use the same page as ours. We remember through info->used_key_del==1
that we will have to set state.key_del at unlock time and wake up
waiters.
If the caller wants to free a block (_ma_dispose()), "empty" and
"non-empty" are treated as "non-empty" is treated above.
When we are ready to unlock, we copy share->current_key_del into
state.key_del. Unlocking happens when writing the UNDO log record, that
can make a long lock time.
Why we wrote "*looks* empty": because we are looking at state.key_del
which may be slightly old (share->current_key_del may be more recent and
exact): when we want a new page, we tolerate to treat "there was no free
page 1 millisecond ago" as "there is no free page". It's ok to non-pop
(_ma_new(), page will be found later anyway) but it's not ok to non-push
(_ma_dispose(), page would be lost).
When we leave this function, info->used_key_del is always 1 or 2.
*/
if (info->used_key_del != 1)
{
pthread_mutex_lock(&share->intern_lock);
......@@ -1140,7 +1218,7 @@ void _ma_unlock_key_del(MARIA_HA *info)
MARIA_SHARE *share= info->s;
pthread_mutex_lock(&share->intern_lock);
share->used_key_del= 0;
share->state.key_del= info->s->current_key_del;
share->state.key_del= share->current_key_del;
pthread_mutex_unlock(&share->intern_lock);
pthread_cond_signal(&share->intern_cond);
}
......
......@@ -46,6 +46,13 @@ my_bool _ma_write_clr(MARIA_HA *info, LSN undo_lsn,
enum translog_record_type undo_type,
my_bool store_checksum, ha_checksum checksum,
LSN *res_lsn, void *extra_msg);
int _ma_write_undo_key_insert(MARIA_HA *info, const MARIA_KEYDEF *keyinfo,
const uchar *key, uint key_length,
my_off_t *root, my_off_t new_root,
LSN *res_lsn);
int _ma_write_undo_key_delete(MARIA_HA *info, uint keynr,
const uchar *key, uint key_length,
my_off_t new_root, LSN *res_lsn);
my_bool write_hook_for_clr_end(enum translog_record_type type,
TRN *trn, MARIA_HA *tbl_info, LSN *lsn,
void *hook_arg);
......@@ -70,6 +77,13 @@ my_bool _ma_log_add(MARIA_HA *info, my_off_t page, uchar *buff,
uint buff_length, uchar *key_pos,
uint changed_length, int move_length,
my_bool handle_overflow);
my_bool _ma_log_delete(MARIA_HA *info, my_off_t page, const uchar *buff,
const uchar *key_pos, uint changed_length,
uint move_length);
my_bool _ma_log_change(MARIA_HA *info, my_off_t page, const uchar *buff,
const uchar *key_pos, uint length);
my_bool _ma_log_new(MARIA_HA *info, my_off_t page, const uchar *buff,
uint page_length, uint key_nr, my_bool root_page);
uint _ma_apply_redo_index_new_page(MARIA_HA *info, LSN lsn,
const uchar *header, uint length);
......
......@@ -160,7 +160,8 @@ enum en_key_op
KEY_OP_DEL_PREFIX, /* Delete data at start of page */
KEY_OP_ADD_SUFFIX, /* Insert data at end of page */
KEY_OP_DEL_SUFFIX, /* Delete data at end of page */
KEY_OP_CHECK /* For debugging; CRC of used part of page */
KEY_OP_CHECK, /* For debugging; CRC of used part of page */
KEY_OP_MULTI_COPY /* List of memcpy()s with fixed-len sources in page */
};
/* Size of log file; One log file is restricted to 4G */
......
......@@ -172,7 +172,8 @@ int _ma_write_keypage(register MARIA_HA *info,
@param page_not_read 1 if page has not yet been read
@note
The page at 'pos' must have been read with a write lock
The page at 'pos' must have been read with a write lock.
This function does logging (unlike _ma_new()).
@return
@retval 0 ok
......@@ -283,6 +284,10 @@ int _ma_dispose(register MARIA_HA *info, my_off_t pos, my_bool page_not_read)
check if this is used by checking if
page_link->changed != 0
@note Logging of this is left to the caller (so that the "new"ing and the
first changes done to this new page can be logged as one single entry - one
single _ma_log_new()) call).
@return
HA_OFFSET_ERROR File is full or page read error
# Page address to use
......
......@@ -4455,7 +4455,7 @@ int flush_pagecache_blocks_with_filter(PAGECACHE *pagecache,
void *filter_arg)
{
int res;
DBUG_ENTER("flush_pagecache_blocks");
DBUG_ENTER("flush_pagecache_blocks_with_filter");
DBUG_PRINT("enter", ("pagecache: 0x%lx", (long) pagecache));
if (pagecache->disk_blocks <= 0)
......
......@@ -455,8 +455,9 @@ int maria_rtree_get_next(MARIA_HA *info, uint keynr, uint key_length)
/*
Choose non-leaf better key for insertion
*/
Returns a pointer inside the page_buf buffer.
*/
#ifdef PICK_BY_PERIMETER
static const uchar *maria_rtree_pick_key(const MARIA_HA *info,
const MARIA_KEYDEF *keyinfo,
......@@ -548,10 +549,11 @@ static int maria_rtree_insert_req(MARIA_HA *info,
my_off_t *new_page,
int ins_level, int level)
{
uint nod_flag;
uint nod_flag, page_link_idx;
int res;
uchar *page_buf, *k;
MARIA_PINNED_PAGE *page_link;
MARIA_SHARE *share= info->s;
DBUG_ENTER("maria_rtree_insert_req");
if (!(page_buf= (uchar*) my_alloca((uint)keyinfo->block_length +
......@@ -563,7 +565,8 @@ static int maria_rtree_insert_req(MARIA_HA *info,
if (!_ma_fetch_keypage(info, keyinfo, page, PAGECACHE_LOCK_WRITE,
DFLT_INIT_HITS, page_buf, 0, &page_link))
goto err1;
nod_flag= _ma_test_if_nod(info->s, page_buf);
page_link_idx= page_link_to_idx(info);
nod_flag= _ma_test_if_nod(share, page_buf);
DBUG_PRINT("rtree", ("page: %lu level: %d ins_level: %d nod_flag: %u",
(ulong) page, level, ins_level, nod_flag));
......@@ -578,10 +581,13 @@ static int maria_rtree_insert_req(MARIA_HA *info,
_ma_kpos(nod_flag, k), new_page,
ins_level, level + 1)))
{
case 0: /* child was not split */
case 0: /* child was not split, most common case */
{
maria_rtree_combine_rect(keyinfo->seg, k, key, k, key_length);
page_link->changed= 1;
if (share->now_transactional &&
_ma_log_change(info, page, page_buf, k, key_length))
goto err1;
page_link_from_idx(info, page_link_idx)->changed= 1;
if (_ma_write_keypage(info, keyinfo, page,
PAGECACHE_LOCK_LEFT_WRITELOCKED,
DFLT_INIT_HITS, page_buf))
......@@ -595,14 +601,17 @@ static int maria_rtree_insert_req(MARIA_HA *info,
if (maria_rtree_set_key_mbr(info, keyinfo, k, key_length,
_ma_kpos(nod_flag, k)))
goto err1;
if (share->now_transactional &&
_ma_log_change(info, page, page_buf, k, key_length))
goto err1;
/* add new key for new page */
_ma_kpointer(info, new_key - nod_flag, *new_page);
if (maria_rtree_set_key_mbr(info, keyinfo, new_key, key_length,
*new_page))
goto err1;
res= maria_rtree_add_key(info, keyinfo, new_key, key_length,
page_buf, new_page);
page_link->changed= 1;
page_buf, page, new_page);
page_link_from_idx(info, page_link_idx)->changed= 1;
if (_ma_write_keypage(info, keyinfo, page,
PAGECACHE_LOCK_LEFT_WRITELOCKED,
DFLT_INIT_HITS, page_buf))
......@@ -619,8 +628,8 @@ static int maria_rtree_insert_req(MARIA_HA *info,
else
{
res= maria_rtree_add_key(info, keyinfo, key, key_length, page_buf,
new_page);
page_link->changed= 1;
page, new_page);
page_link_from_idx(info, page_link_idx)->changed= 1;
if (_ma_write_keypage(info, keyinfo, page, PAGECACHE_LOCK_LEFT_WRITELOCKED,
DFLT_INIT_HITS, page_buf))
goto err1;
......@@ -636,18 +645,24 @@ err1:
}
/*
/**
Insert key into the tree
RETURN
-1 Error
0 Root was not split
1 Root was split
@param info table
@param keynr key's number
@param key key to insert
@param key_length key's length
@param ins_level at which level key insertion should start
@param root put new key_root there
@return Operation result
@retval -1 Error
@retval 0 Root was not split
@retval 1 Root was split
*/
int maria_rtree_insert_level(MARIA_HA *info, uint keynr,
const uchar *key,
uint key_length, int ins_level)
int maria_rtree_insert_level(MARIA_HA *info, uint keynr, const uchar *key,
uint key_length, int ins_level, my_off_t *root)
{
my_off_t old_root;
MARIA_SHARE *share= info->s;
......@@ -655,6 +670,7 @@ int maria_rtree_insert_level(MARIA_HA *info, uint keynr,
int res;
my_off_t new_page;
MARIA_PINNED_PAGE *page_link;
enum pagecache_page_lock write_lock;
DBUG_ENTER("maria_rtree_insert_level");
if ((old_root= share->state.key_root[keynr]) == HA_OFFSET_ERROR)
......@@ -664,18 +680,23 @@ int maria_rtree_insert_level(MARIA_HA *info, uint keynr,
if ((old_root= _ma_new(info, DFLT_INIT_HITS, &page_link)) ==
HA_OFFSET_ERROR)
DBUG_RETURN(-1);
write_lock= page_link->write_lock;
info->keyread_buff_used= 1;
bzero(info->buff, share->block_size);
_ma_store_keynr(share, info->buff, keynr);
_ma_store_page_used(share, info->buff, share->keypage_header);
if (share->now_transactional &&
_ma_log_new(info, old_root, info->buff, share->keypage_header,
keyinfo->key_nr, 1))
DBUG_RETURN(1);
res= maria_rtree_add_key(info, keyinfo, key, key_length, info->buff,
NULL);
if (_ma_write_keypage(info, keyinfo, old_root,
page_link->write_lock,
old_root, NULL);
if (_ma_write_keypage(info, keyinfo, old_root, write_lock,
DFLT_INIT_HITS, info->buff))
DBUG_RETURN(1);
share->state.key_root[keynr]= old_root;
*root= old_root;
DBUG_RETURN(res);
}
......@@ -686,7 +707,7 @@ int maria_rtree_insert_level(MARIA_HA *info, uint keynr,
{
break;
}
case 1: /* root was split, grow a new root */
case 1: /* root was split, grow a new root; very rare */
{
uchar *new_root_buf, *new_key;
my_off_t new_root;
......@@ -710,6 +731,12 @@ int maria_rtree_insert_level(MARIA_HA *info, uint keynr,
if ((new_root= _ma_new(info, DFLT_INIT_HITS, &page_link)) ==
HA_OFFSET_ERROR)
goto err1;
write_lock= page_link->write_lock;
if (share->now_transactional &&
_ma_log_new(info, new_root, new_root_buf, share->keypage_header,
keyinfo->key_nr, 1))
goto err1;
new_key= new_root_buf + keyinfo->block_length + nod_flag;
......@@ -718,7 +745,7 @@ int maria_rtree_insert_level(MARIA_HA *info, uint keynr,
old_root))
goto err1;
if (maria_rtree_add_key(info, keyinfo, new_key, key_length, new_root_buf,
NULL)
new_root, NULL)
== -1)
goto err1;
_ma_kpointer(info, new_key - nod_flag, new_page);
......@@ -726,13 +753,13 @@ int maria_rtree_insert_level(MARIA_HA *info, uint keynr,
new_page))
goto err1;
if (maria_rtree_add_key(info, keyinfo, new_key, key_length, new_root_buf,
NULL)
new_root, NULL)
== -1)
goto err1;
if (_ma_write_keypage(info, keyinfo, new_root, page_link->write_lock,
if (_ma_write_keypage(info, keyinfo, new_root, write_lock,
DFLT_INIT_HITS, new_root_buf))
goto err1;
share->state.key_root[keynr]= new_root;
*root= new_root;
DBUG_PRINT("rtree", ("new root page: %lu level: %d nod_flag: %u",
(ulong) new_root, 0,
_ma_test_if_nod(share, new_root_buf)));
......@@ -746,6 +773,7 @@ err1:
default:
case -1: /* error */
{
DBUG_ASSERT(0);
break;
}
}
......@@ -765,12 +793,29 @@ int maria_rtree_insert(MARIA_HA *info, uint keynr,
uchar *key, uint key_length)
{
int res;
MARIA_SHARE *share= info->s;
my_off_t *root= &share->state.key_root[keynr];
my_off_t new_root= *root;
LSN lsn= LSN_IMPOSSIBLE;
DBUG_ENTER("maria_rtree_insert");
res= - (!key_length ||
(maria_rtree_insert_level(info, keynr, key, key_length, -1) == -1));
_ma_fast_unlock_key_del(info);
/** @todo RECOVERY use a real LSN */
_ma_unpin_all_pages_and_finalize_row(info, LSN_IMPOSSIBLE);
if (key_length == 0)
{
res= -1;
goto err;
}
if ((res= -(maria_rtree_insert_level(info, keynr, key, key_length, -1,
&new_root) == -1)) != 0)
goto err;
if (share->now_transactional)
res= _ma_write_undo_key_insert(info, share->keyinfo + keynr,
key, key_length, root, new_root, &lsn);
else
{
*root= new_root;
_ma_fast_unlock_key_del(info);
}
_ma_unpin_all_pages_and_finalize_row(info, lsn);
err:
DBUG_RETURN(res);
}
......@@ -823,7 +868,7 @@ static int maria_rtree_delete_req(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
stPageList *ReinsertList, int level)
{
ulong i;
uint nod_flag;
uint nod_flag, page_link_idx;
int res;
uchar *page_buf, *last, *k;
MARIA_PINNED_PAGE *page_link;
......@@ -838,6 +883,7 @@ static int maria_rtree_delete_req(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
if (!_ma_fetch_keypage(info, keyinfo, page, PAGECACHE_LOCK_WRITE,
DFLT_INIT_HITS, page_buf, 0, &page_link))
goto err1;
page_link_idx= page_link_to_idx(info);
nod_flag= _ma_test_if_nod(share, page_buf);
DBUG_PRINT("rtree", ("page: %lu level: %d nod_flag: %u",
(ulong) page, level, nod_flag));
......@@ -868,7 +914,10 @@ static int maria_rtree_delete_req(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
if (maria_rtree_set_key_mbr(info, keyinfo, k, key_length,
_ma_kpos(nod_flag, k)))
goto err1;
page_link->changed= 1;
if (share->now_transactional &&
_ma_log_change(info, page, page_buf, k, key_length))
goto err1;
page_link_from_idx(info, page_link_idx)->changed= 1;
if (_ma_write_keypage(info, keyinfo, page,
PAGECACHE_LOCK_LEFT_WRITELOCKED,
DFLT_INIT_HITS, page_buf))
......@@ -894,8 +943,10 @@ static int maria_rtree_delete_req(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
subtree. So we need to re-insert its keys on the same
level later to reintegrate the subtrees.
*/
maria_rtree_delete_key(info, page_buf, k, key_length, nod_flag);
page_link->changed= 1;
if (maria_rtree_delete_key(info, page_buf, k, key_length,
nod_flag, page))
goto err1;
page_link_from_idx(info, page_link_idx)->changed= 1;
if (_ma_write_keypage(info, keyinfo, page,
PAGECACHE_LOCK_LEFT_WRITELOCKED,
DFLT_INIT_HITS, page_buf))
......@@ -911,8 +962,10 @@ static int maria_rtree_delete_req(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
}
case 2: /* vacuous case: last key in the leaf */
{
maria_rtree_delete_key(info, page_buf, k, key_length, nod_flag);
page_link->changed= 1;
if (maria_rtree_delete_key(info, page_buf, k, key_length,
nod_flag, page))
goto err1;
page_link_from_idx(info, page_link_idx)->changed= 1;
if (_ma_write_keypage(info, keyinfo, page,
PAGECACHE_LOCK_LEFT_WRITELOCKED,
DFLT_INIT_HITS, page_buf))
......@@ -935,9 +988,11 @@ static int maria_rtree_delete_req(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
if (!maria_rtree_key_cmp(keyinfo->seg, key, k, key_length,
MBR_EQUAL | MBR_DATA))
{
page_link->changed= 1;
page_link_from_idx(info, page_link_idx)->changed= 1;
maria_rtree_delete_key(info, page_buf, k, key_length, nod_flag);
if (maria_rtree_delete_key(info, page_buf, k, key_length, nod_flag,
page))
goto err1;
*page_size= _ma_get_page_used(share, page_buf);
if (*page_size == info->s->keypage_header)
{
......@@ -982,13 +1037,40 @@ int maria_rtree_delete(MARIA_HA *info, uint keynr,
uchar *key, uint key_length)
{
MARIA_SHARE *share= info->s;
uint page_size;
my_off_t new_root= share->state.key_root[keynr];
int res;
LSN lsn= LSN_IMPOSSIBLE;
DBUG_ENTER("maria_rtree_delete");
if ((res= maria_rtree_real_delete(info, keynr, key, key_length,
&new_root)))
goto err;
if (share->now_transactional)
res= _ma_write_undo_key_delete(info, keynr, key, key_length,
new_root, &lsn);
else
share->state.key_root[keynr]= new_root;
err:
_ma_fast_unlock_key_del(info);
_ma_unpin_all_pages_and_finalize_row(info, lsn);
DBUG_RETURN(res);
}
int maria_rtree_real_delete(MARIA_HA *info, uint keynr,
const uchar *key, uint key_length,
my_off_t *root)
{
MARIA_SHARE *share= info->s;
uint page_size, page_link_idx;
stPageList ReinsertList;
my_off_t old_root;
MARIA_KEYDEF *keyinfo= info->s->keyinfo + keynr;
MARIA_PINNED_PAGE *page_link, *root_page_link;
int res;
DBUG_ENTER("maria_rtree_delete");
DBUG_ENTER("maria_rtree_real_delete");
if ((old_root= share->state.key_root[keynr]) == HA_OFFSET_ERROR)
{
......@@ -1006,7 +1088,7 @@ int maria_rtree_delete(MARIA_HA *info, uint keynr,
&page_size, &ReinsertList, 0)) {
case 2: /* empty */
{
share->state.key_root[keynr]= HA_OFFSET_ERROR;
*root= HA_OFFSET_ERROR;
res= 0;
goto err;
}
......@@ -1027,6 +1109,7 @@ int maria_rtree_delete(MARIA_HA *info, uint keynr,
PAGECACHE_LOCK_WRITE,
DFLT_INIT_HITS, page_buf, 0, &page_link))
goto err1;
page_link_idx= page_link_to_idx(info);
nod_flag= _ma_test_if_nod(share, page_buf);
DBUG_PRINT("rtree", ("reinserting keys from "
"page: %lu level: %d nod_flag: %u",
......@@ -1039,7 +1122,8 @@ int maria_rtree_delete(MARIA_HA *info, uint keynr,
{
if ((res=
maria_rtree_insert_level(info, keynr, k, key_length,
ReinsertList.pages[i].level)) == -1)
ReinsertList.pages[i].level,
root)) == -1)
{
my_afree(page_buf);
goto err1;
......@@ -1059,7 +1143,7 @@ int maria_rtree_delete(MARIA_HA *info, uint keynr,
}
res= 0;
my_afree(page_buf);
page_link->changed= 1;
page_link_from_idx(info, page_link_idx)->changed= 1;
if (_ma_dispose(info, ReinsertList.pages[i].offs, 0))
goto err1;
}
......@@ -1067,7 +1151,7 @@ int maria_rtree_delete(MARIA_HA *info, uint keynr,
my_free((uchar*) ReinsertList.pages, MYF(0));
/* check for redundant root (not leaf, 1 child) and eliminate */
if ((old_root= share->state.key_root[keynr]) == HA_OFFSET_ERROR)
if ((old_root= *root) == HA_OFFSET_ERROR)
goto err1;
if (!_ma_fetch_keypage(info, keyinfo, old_root,
PAGECACHE_LOCK_WRITE,
......@@ -1078,13 +1162,11 @@ int maria_rtree_delete(MARIA_HA *info, uint keynr,
if (nod_flag && (page_size == share->keypage_header + key_length +
nod_flag))
{
my_off_t new_root= _ma_kpos(nod_flag,
rt_PAGE_FIRST_KEY(share, info->buff,
nod_flag));
*root= _ma_kpos(nod_flag,
rt_PAGE_FIRST_KEY(share, info->buff, nod_flag));
root_page_link->changed= 1;
if (_ma_dispose(info, old_root, 0))
goto err1;
share->state.key_root[keynr]= new_root;
}
info->update= HA_STATE_DELETED;
res= 0;
......@@ -1106,9 +1188,6 @@ err1:
goto err; /* purecov: inspected */
}
err:
_ma_fast_unlock_key_del(info);
/** @todo RECOVERY use a real LSN */
_ma_unpin_all_pages_and_finalize_row(info, LSN_IMPOSSIBLE);
DBUG_RETURN(res);
}
......
......@@ -30,6 +30,13 @@ int maria_rtree_insert(MARIA_HA *info, uint keynr, uchar *key,
uint key_length);
int maria_rtree_delete(MARIA_HA *info, uint keynr, uchar *key,
uint key_length);
int maria_rtree_insert_level(MARIA_HA *info, uint keynr,
const uchar *key,
uint key_length, int ins_level,
my_off_t *root);
int maria_rtree_real_delete(MARIA_HA *info, uint keynr,
const uchar *key, uint key_length,
my_off_t *root);
int maria_rtree_find_first(MARIA_HA *info, uint keynr, uchar *key,
uint key_length, uint search_flag);
......@@ -42,9 +49,21 @@ ha_rows maria_rtree_estimate(MARIA_HA *info, uint keynr, uchar *key,
uint key_length, uint flag);
int maria_rtree_split_page(MARIA_HA *info, const MARIA_KEYDEF *keyinfo,
uchar *page,
my_off_t page_offs, uchar *page,
const uchar *key, uint key_length,
my_off_t *new_page_offs);
/**
When you obtain a MARIA_PINNED_PAGE* link (by calling
_ma_fetch_keypage()/_ma_new()/etc), it is valid only until the next call to
those functions on this MARIA_HA*, because that next call may cause a
realloc of the pinned_pages DYNAMIC_ARRAY, causing the first link to become
wrong. The _index_ in the array is however invariant, so in these situations
you should save the index immediately and use it to later obtain an
up-to-date link.
*/
#define page_link_to_idx(INFO) ((INFO)->pinned_pages.elements - 1)
#define page_link_from_idx(INFO, IDX) \
dynamic_element(&(INFO)->pinned_pages, (IDX), MARIA_PINNED_PAGE *)
#endif /*HAVE_RTREE_KEYS*/
#endif /* _rt_index_h */
......@@ -14,6 +14,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "maria_def.h"
#include "trnman.h"
#include "ma_key_recover.h"
#ifdef HAVE_RTREE_KEYS
#include "ma_rt_index.h"
......@@ -31,25 +33,25 @@
int maria_rtree_add_key(MARIA_HA *info, const MARIA_KEYDEF *keyinfo,
const uchar *key,
uint key_length, uchar *page_buf,
uint key_length, uchar *page_buf, my_off_t page,
my_off_t *new_page)
{
MARIA_SHARE *share= info->s;
uint page_size= _ma_get_page_used(share, page_buf);
uint page_size= _ma_get_page_used(share, page_buf), added_len;
uint nod_flag= _ma_test_if_nod(share, page_buf);
uchar *key_pos= rt_PAGE_END(share, page_buf);
DBUG_ENTER("maria_rtree_add_key");
if (page_size + key_length + share->base.rec_reflength <=
keyinfo->block_length)
(uint16)(keyinfo->block_length - KEYPAGE_CHECKSUM_SIZE))
{
/* split won't be necessary */
if (nod_flag)
{
/* save key */
DBUG_ASSERT(_ma_kpos(nod_flag, key) < info->state->key_file_length);
memcpy(rt_PAGE_END(share, page_buf), key - nod_flag,
key_length + nod_flag);
page_size+= key_length + nod_flag;
memcpy(key_pos, key - nod_flag, key_length + nod_flag);
added_len= key_length + nod_flag;
}
else
{
......@@ -58,16 +60,19 @@ int maria_rtree_add_key(MARIA_HA *info, const MARIA_KEYDEF *keyinfo,
share->base.rec_reflength) <
info->state->data_file_length +
share->base.pack_reclength);
memcpy(rt_PAGE_END(share, page_buf), key, key_length +
share->base.rec_reflength);
page_size+= key_length + share->base.rec_reflength;
memcpy(key_pos, key, key_length + share->base.rec_reflength);
added_len= key_length + share->base.rec_reflength;
}
page_size+= added_len;
_ma_store_page_used(share, page_buf, page_size);
if (share->now_transactional &&
_ma_log_add(info, page, page_buf, key_pos - page_buf,
key_pos, added_len, added_len, 0))
DBUG_RETURN(-1);
DBUG_RETURN(0);
}
DBUG_RETURN(maria_rtree_split_page(info, keyinfo, page_buf, key, key_length,
new_page) ? -1 : 1);
DBUG_RETURN(maria_rtree_split_page(info, keyinfo, page, page_buf, key,
key_length, new_page) ? -1 : 1);
}
......@@ -76,10 +81,11 @@ int maria_rtree_add_key(MARIA_HA *info, const MARIA_KEYDEF *keyinfo,
*/
int maria_rtree_delete_key(MARIA_HA *info, uchar *page_buf, uchar *key,
uint key_length, uint nod_flag)
uint key_length, uint nod_flag, my_off_t page)
{
MARIA_SHARE *share= info->s;
uint16 page_size= _ma_get_page_used(share, page_buf);
uint key_length_with_nod_flag;
uchar *key_start;
key_start= key - nod_flag;
......@@ -88,15 +94,20 @@ int maria_rtree_delete_key(MARIA_HA *info, uchar *page_buf, uchar *key,
memmove(key_start, key + key_length, page_size - key_length -
(key - page_buf));
page_size-= key_length + nod_flag;
key_length_with_nod_flag= key_length + nod_flag;
page_size-= key_length_with_nod_flag;
_ma_store_page_used(share, page_buf, page_size);
if (share->now_transactional &&
_ma_log_delete(info, page, page_buf, key_start, 0,
key_length_with_nod_flag))
return -1;
return 0;
}
/*
Calculate and store key MBR
Calculate and store key MBR into *key.
*/
int maria_rtree_set_key_mbr(MARIA_HA *info, const MARIA_KEYDEF *keyinfo,
......
......@@ -23,10 +23,10 @@
int maria_rtree_add_key(MARIA_HA *info, const MARIA_KEYDEF *keyinfo,
const uchar *key,
uint key_length, uchar *page_buf,
uint key_length, uchar *page_buf, my_off_t page,
my_off_t *new_page);
int maria_rtree_delete_key(MARIA_HA *info, uchar *page_buf, uchar *key,
uint key_length, uint nod_flag);
uint key_length, uint nod_flag, my_off_t page);
int maria_rtree_set_key_mbr(MARIA_HA *info, const MARIA_KEYDEF *keyinfo,
uchar *key,
uint key_length, my_off_t child_page);
......
......@@ -261,6 +261,7 @@ double maria_rtree_rect_volume(HA_KEYSEG *keyseg, uchar *a, uint key_length)
/*
Creates an MBR as an array of doubles.
Fills *res.
*/
int maria_rtree_d_mbr(const HA_KEYSEG *keyseg, const uchar *a,
......@@ -528,6 +529,7 @@ double maria_rtree_overlapping_area(HA_KEYSEG *keyseg, uchar* a, uchar* b,
/*
Calculates MBR_AREA(a+b) - MBR_AREA(a)
Fills *ab_area.
Note: when 'a' and 'b' objects are far from each other,
the area increase can be really big, so this function
can return 'inf' as a result.
......@@ -739,6 +741,7 @@ double maria_rtree_perimeter_increase(HA_KEYSEG *keyseg, uchar* a, uchar* b,
/*
Calculates key page total MBR= MBR(key1) + MBR(key2) + ...
Stores into *c.
*/
int maria_rtree_page_mbr(const MARIA_HA *info, const HA_KEYSEG *keyseg,
const uchar *page_buf,
......
......@@ -15,6 +15,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "maria_def.h"
#include "trnman.h"
#include "ma_key_recover.h"
#ifdef HAVE_RTREE_KEYS
......@@ -89,8 +91,11 @@ inline static void copy_coords(double *dst, const double *src, int n_dim)
memcpy(dst, src, sizeof(double) * (n_dim * 2));
}
/*
Select two nodes to collect group upon
/**
Select two nodes to collect group upon.
Note that such function uses 'double' arithmetic so may behave differently
on different platforms/builds. There are others in this file.
*/
static void pick_seeds(SplitStruct *node, int n_entries,
SplitStruct **seed_a, SplitStruct **seed_b, int n_dim)
......@@ -247,11 +252,136 @@ static int split_maria_rtree_node(SplitStruct *node, int n_entries,
return 0;
}
/**
Logs key reorganization done in a split page (new page is logged elsewhere).
The effect of a split on the split page is three changes:
- some piece of the page move to different places inside this page (we are
not interested here in the pieces which move to the new page)
- the key is inserted into the page or not (could be in the new page)
- page is shrunk
All this is uniquely determined by a few parameters:
- the key (starting at 'key-nod_flag', for 'full_length' bytes
(maria_rtree_split_page() seems to depend on its parameters key&key_length
but in fact it reads more (to the left: nod_flag, and to the right:
full_length)
- the binary content of the page
- some variables in the share
- double arithmetic, which is unpredictable from machine to machine and
from build to build (see pick_seeds() above: it has a comparison between
double-s 'if (d > max_d)' so the comparison can go differently from machine
to machine or build to build, it has happened in real life).
If one day we use precision-math instead of double-math, in GIS, then the
last parameter would become constant accross machines and builds and we
could some cheap logging: just log the few parameters above.
Until then, we log the list of memcpy() operations (fortunately, we often do
not have to log the source bytes, as they can be found in the page before
applying the REDO; the only source bytes to log are the key), the key if it
was inserted into this page, and the shrinking.
@param info table
@param page page's offset in the file
@param buff content of the page (post-split)
@param key_with_nod_flag pointer to key-nod_flag
@param full_length length of (key + (nod_flag (if node) or rowid (if
leaf)))
@param log_internal_copy encoded list of mempcy() operations done on
split page, having their source in the page
@param log_internal_copy_length length of above list, in bytes
@param log_key_copy operation describing the key's copy, or NULL if the
inserted key was not put into the page (was put in
new page, so does not have to be logged here)
@param length_diff by how much the page has shrunk during split
*/
static my_bool _ma_log_rt_split(MARIA_HA *info,
my_off_t page, const uchar *buff,
const uchar *key_with_nod_flag,
uint full_length,
const uchar *log_internal_copy,
uint log_internal_copy_length,
const uchar *log_key_copy,
uint length_diff)
{
MARIA_SHARE *share= info->s;
LSN lsn;
uchar log_data[FILEID_STORE_SIZE + PAGE_STORE_SIZE + 1 + 2 + 1 + 2 + 2 + 7],
*log_pos;
LEX_CUSTRING log_array[TRANSLOG_INTERNAL_PARTS + 5];
uint translog_parts, extra_length= 0;
DBUG_ENTER("_ma_log_rt_split");
DBUG_PRINT("enter", ("page: %lu", (ulong) page));
DBUG_ASSERT(share->now_transactional);
page/= share->block_size;
page_store(log_data + FILEID_STORE_SIZE, page);
log_pos= log_data+ FILEID_STORE_SIZE + PAGE_STORE_SIZE;
log_pos[0]= KEY_OP_DEL_SUFFIX;
log_pos++;
DBUG_ASSERT((int)length_diff > 0);
int2store(log_pos, length_diff);
log_pos+= 2;
log_pos[0]= KEY_OP_MULTI_COPY;
log_pos++;
int2store(log_pos, full_length);
log_pos+= 2;
int2store(log_pos, log_internal_copy_length);
log_array[TRANSLOG_INTERNAL_PARTS + 0].str= log_data;
log_array[TRANSLOG_INTERNAL_PARTS + 0].length= sizeof(log_data) - 7;
log_array[TRANSLOG_INTERNAL_PARTS + 1].str= log_internal_copy;
log_array[TRANSLOG_INTERNAL_PARTS + 1].length= log_internal_copy_length;
translog_parts= 2;
if (log_key_copy != NULL) /* need to store key into record */
{
log_array[TRANSLOG_INTERNAL_PARTS + 2].str= log_key_copy;
log_array[TRANSLOG_INTERNAL_PARTS + 2].length= 1 + 2 + 1 + 2;
log_array[TRANSLOG_INTERNAL_PARTS + 3].str= key_with_nod_flag;
log_array[TRANSLOG_INTERNAL_PARTS + 3].length= full_length;
extra_length= 1 + 2 + 1 + 2 + full_length;
translog_parts+= 2;
}
#ifdef EXTRA_DEBUG_KEY_CHANGES
{
int page_length= _ma_get_page_used(share, buff);
ha_checksum crc;
crc= my_checksum(0, buff + LSN_STORE_SIZE, page_length - LSN_STORE_SIZE);
log_pos+= 2;
log_pos[0]= KEY_OP_CHECK;
int2store(log_pos + 1, page_length);
int4store(log_pos + 3, crc);
log_array[TRANSLOG_INTERNAL_PARTS + translog_parts].str= log_pos;
log_array[TRANSLOG_INTERNAL_PARTS + translog_parts].length= 7;
extra_length+= 7;
translog_parts++;
}
#endif
if (translog_write_record(&lsn, LOGREC_REDO_INDEX,
info->trn, info,
(translog_size_t) ((log_pos - log_data) +
log_internal_copy_length +
extra_length),
TRANSLOG_INTERNAL_PARTS + translog_parts,
log_array, log_data, NULL))
DBUG_RETURN(1);
DBUG_RETURN(0);
}
/**
0 ok; the created page is put into page cache; the shortened one is not (up
to the caller to do it)
1 or -1: error.
If new_page_offs==NULL, won't create new page (for redo phase).
*/
int maria_rtree_split_page(MARIA_HA *info, const MARIA_KEYDEF *keyinfo,
uchar *page, const uchar *key,
my_off_t page_offs, uchar *page, const uchar *key,
uint key_length, my_off_t *new_page_offs)
{
MARIA_SHARE *share= info->s;
const my_bool transactional= share->now_transactional;
int n1, n2; /* Number of items in groups */
SplitStruct *task;
SplitStruct *cur;
......@@ -261,12 +391,14 @@ int maria_rtree_split_page(MARIA_HA *info, const MARIA_KEYDEF *keyinfo,
double *old_coord;
int n_dim;
uchar *source_cur, *cur1, *cur2;
uchar *new_page;
uchar *new_page, *log_internal_copy, *log_internal_copy_ptr,
*log_key_copy= NULL;
int err_code= 0;
uint nod_flag= _ma_test_if_nod(share, page);
uint org_length= _ma_get_page_used(share, page), new_length;
uint full_length= key_length + (nod_flag ? nod_flag :
share->base.rec_reflength);
int max_keys= ((_ma_get_page_used(share, page) - share->keypage_header) /
int max_keys= ((org_length - share->keypage_header) /
(full_length));
MARIA_PINNED_PAGE tmp_page_link, *page_link= &tmp_page_link;
DBUG_ENTER("maria_rtree_split_page");
......@@ -312,11 +444,16 @@ int maria_rtree_split_page(MARIA_HA *info, const MARIA_KEYDEF *keyinfo,
goto split_err;
}
if (!(new_page= (uchar*) my_alloca((uint)keyinfo->block_length)))
/* Allocate buffer for new page and piece of log record */
if (!(new_page= (uchar*) my_alloca((uint)keyinfo->block_length +
(transactional ?
(max_keys * (2 + 2) +
1 + 2 + 1 + 2) : 0))))
{
err_code= -1;
goto split_err;
}
log_internal_copy= log_internal_copy_ptr= new_page + keyinfo->block_length;
bzero(new_page, share->block_size);
stop= task + (max_keys + 1);
......@@ -327,47 +464,94 @@ int maria_rtree_split_page(MARIA_HA *info, const MARIA_KEYDEF *keyinfo,
for (cur= task; cur < stop; cur++)
{
uchar *to;
const uchar *cur_key= cur->key;
my_bool log_this_change;
DBUG_ASSERT(log_key_copy == NULL);
if (cur->n_node == 1)
{
to= cur1;
cur1= rt_PAGE_NEXT_KEY(share, cur1, key_length, nod_flag);
n1++;
log_this_change= transactional;
}
else
{
to= cur2;
cur2= rt_PAGE_NEXT_KEY(share, cur2, key_length, nod_flag);
n2++;
log_this_change= FALSE;
}
if (to != cur->key)
memcpy(to - nod_flag, cur->key - nod_flag, full_length);
if (to != cur_key)
{
uchar *to_with_nod_flag= to - nod_flag;
const uchar *cur_key_with_nod_flag= cur_key - nod_flag;
memcpy(to_with_nod_flag, cur_key_with_nod_flag, full_length);
if (log_this_change)
{
uint to_with_nod_flag_offs= to_with_nod_flag - page;
if (likely(cur_key != key))
{
/* this memcpy() is internal to the page (source in the page) */
uint cur_key_with_nod_flag_offs= cur_key_with_nod_flag - page;
int2store(log_internal_copy_ptr, to_with_nod_flag_offs);
log_internal_copy_ptr+= 2;
int2store(log_internal_copy_ptr, cur_key_with_nod_flag_offs);
log_internal_copy_ptr+= 2;
}
else
{
/* last iteration, and this involves *key: source is external */
log_key_copy= log_internal_copy_ptr;
log_key_copy[0]= KEY_OP_OFFSET;
int2store(log_key_copy + 1, to_with_nod_flag_offs);
log_key_copy[3]= KEY_OP_CHANGE;
int2store(log_key_copy + 4, full_length);
/* _ma_log_rt_split() will store *key, right after */
}
}
}
}
{ /* verify that above loop didn't touch header bytes */
uint i;
for (i= 0; i < share->keypage_header; i++)
DBUG_ASSERT(new_page[i]==0);
}
if (nod_flag)
_ma_store_keypage_flag(share, new_page, KEYPAGE_FLAG_ISNOD);
_ma_store_keynr(share, new_page, keyinfo->key_nr);
_ma_store_page_used(share, page, share->keypage_header + n1 * full_length)
_ma_store_page_used(share, new_page, share->keypage_header +
n2 * full_length);
new_length= share->keypage_header + n1 * full_length;
_ma_store_page_used(share, page, new_length);
if ((*new_page_offs= _ma_new(info, DFLT_INIT_HITS, &page_link)) ==
HA_OFFSET_ERROR)
err_code= -1;
else
err_code= _ma_write_keypage(info, keyinfo, *new_page_offs,
page_link->write_lock,
DFLT_INIT_HITS, new_page);
{
if (transactional &&
( /* log change to split page */
_ma_log_rt_split(info, page_offs, page, key - nod_flag,
full_length, log_internal_copy,
log_internal_copy_ptr - log_internal_copy,
log_key_copy, org_length - new_length) ||
/* and to new page */
_ma_log_new(info, *new_page_offs, new_page,
share->keypage_header + n2 * full_length,
keyinfo->key_nr, 0)))
err_code= -1;
if ( _ma_write_keypage(info, keyinfo, *new_page_offs,
page_link->write_lock,
DFLT_INIT_HITS, new_page))
err_code= -1;
}
DBUG_PRINT("rtree", ("split new block: %lu", (ulong) *new_page_offs));
my_afree((uchar*)new_page);
my_afree(new_page);
split_err:
/**
@todo the cast below is useless (coord_buf is uchar*); at the moment we
changed all "byte" to "uchar", some casts became useless and should be
removed.
*/
my_afree((uchar*) coord_buf);
my_afree(coord_buf);
DBUG_RETURN(err_code);
}
......
......@@ -17,7 +17,12 @@
/* Written by Alex Barkov who has a shared copyright to this code */
#include "maria.h"
#include "maria_def.h"
#include "ma_control_file.h"
#include "ma_loghandler.h"
#include "ma_checkpoint.h"
#include "trnman.h"
#include <my_getopt.h>
#ifdef HAVE_RTREE_KEYS
......@@ -27,11 +32,13 @@
#define ndims 2
#define KEYALG HA_KEY_ALG_RTREE
static int read_with_pos(MARIA_HA * file, int silent);
static int read_with_pos(MARIA_HA * file);
static void create_record(uchar *record,uint rownr);
static void create_record1(uchar *record,uint rownr);
static void print_record(uchar * record,my_off_t offs,const char * tail);
static int run_test(const char *filename);
static void get_options(int argc, char *argv[]);
static void usage();
static double rt_data[]=
{
......@@ -79,10 +86,32 @@ static double rt_data[]=
-1
};
int main(int argc __attribute__((unused)),char *argv[] __attribute__((unused)))
static int silent= 0, testflag= 0, transactional= 0,
die_in_middle_of_transaction= 0, checkpoint= 0, create_flag= 0;
static enum data_file_type record_type= DYNAMIC_RECORD;
int main(int argc, char *argv[])
{
MY_INIT(argv[0]);
maria_init();
get_options(argc, argv);
maria_data_root= (char *)".";
/* Maria requires that we always have a page cache */
if (maria_init() ||
(init_pagecache(maria_pagecache, maria_block_size * 16, 0, 0,
maria_block_size, MY_WME) == 0) ||
ma_control_file_open(TRUE) ||
(init_pagecache(maria_log_pagecache,
TRANSLOG_PAGECACHE_SIZE, 0, 0,
TRANSLOG_PAGE_SIZE, MY_WME) == 0) ||
translog_init(maria_data_root, TRANSLOG_FILE_SIZE,
0, 0, maria_log_pagecache,
TRANSLOG_DEFAULT_FLAGS, 0) ||
(transactional && (trnman_init(0) || ma_checkpoint_init(0))))
{
fprintf(stderr, "Error in initialization\n");
exit(1);
}
exit(run_test("rt_test"));
}
......@@ -97,16 +126,14 @@ static int run_test(const char *filename)
HA_KEYSEG keyseg[20];
key_range range;
int silent=0;
int opt_unique=0;
int create_flag=0;
int key_type=HA_KEYTYPE_DOUBLE;
int key_length=8;
int null_fields=0;
int nrecords=sizeof(rt_data)/(sizeof(double)*4);/* 3000;*/
int rec_length=0;
int uniques=0;
int i;
int i, max_i;
int error;
int row_count=0;
uchar record[MAX_REC_LENGTH];
......@@ -152,9 +179,10 @@ static int run_test(const char *filename)
bzero((char*) &create_info,sizeof(create_info));
create_info.max_rows=10000000;
create_info.transactional= transactional;
if (maria_create(filename,
DYNAMIC_RECORD,
record_type,
1, /* keys */
keyinfo,
1+2*ndims+opt_unique, /* columns */
......@@ -166,7 +194,11 @@ static int run_test(const char *filename)
if (!(file=maria_open(filename,2,HA_OPEN_ABORT_IF_LOCKED)))
goto err;
maria_begin(file);
if (testflag == 1)
goto end;
if (checkpoint == 1 && ma_checkpoint_execute(CHECKPOINT_MEDIUM, FALSE))
goto err;
if (!silent)
printf("- Writing key:s\n");
......@@ -186,7 +218,7 @@ static int run_test(const char *filename)
}
}
if ((error=read_with_pos(file,silent)))
if ((error=read_with_pos(file)))
goto err;
if (!silent)
......@@ -198,7 +230,7 @@ static int run_test(const char *filename)
create_record(record,i);
bzero((char*) read_record,MAX_REC_LENGTH);
error=maria_rkey(file,read_record,0,record+1,0,HA_READ_MBR_EQUAL);
error=maria_rkey(file,read_record,0,record+1,HA_WHOLE_KEY,HA_READ_MBR_EQUAL);
if (error && error!=HA_ERR_KEY_NOT_FOUND)
{
......@@ -213,13 +245,25 @@ static int run_test(const char *filename)
print_record(read_record,maria_position(file),"\n");
}
if (checkpoint == 2 && ma_checkpoint_execute(CHECKPOINT_MEDIUM, FALSE))
goto err;
if (testflag == 2)
goto end;
if (!silent)
printf("- Deleting rows\n");
if (maria_scan_init(file))
{
fprintf(stderr, "maria_scan_init failed\n");
goto err;
}
for (i=0; i < nrecords/4; i++)
{
my_errno=0;
bzero((char*) read_record,MAX_REC_LENGTH);
error=maria_rrnd(file,read_record,i == 0 ? 0L : HA_OFFSET_ERROR);
error=maria_scan(file,read_record);
if (error)
{
printf("pos: %2d maria_rrnd: %3d errno: %3d\n",i,error,my_errno);
......@@ -234,18 +278,39 @@ static int run_test(const char *filename)
goto err;
}
}
maria_scan_end(file);
if (testflag == 3)
goto end;
if (checkpoint == 3 && ma_checkpoint_execute(CHECKPOINT_MEDIUM, FALSE))
goto err;
if (!silent)
printf("- Updating rows with position\n");
for (i=0; i < (nrecords - nrecords/4) ; i++)
if (maria_scan_init(file))
{
fprintf(stderr, "maria_scan_init failed\n");
goto err;
}
/* We are looking for nrecords-necords/2 non-deleted records */
for (i=0, max_i= nrecords - nrecords/2; i < max_i ; i++)
{
my_errno=0;
bzero((char*) read_record,MAX_REC_LENGTH);
error=maria_rrnd(file,read_record,i == 0 ? 0L : HA_OFFSET_ERROR);
error=maria_scan(file,read_record);
if (error)
{
if (error==HA_ERR_RECORD_DELETED)
{
printf("found deleted record\n");
/*
In BLOCK_RECORD format, maria_scan() never returns deleted records,
while in DYNAMIC format it can. Don't count such record:
*/
max_i++;
continue;
}
printf("pos: %2d maria_rrnd: %3d errno: %3d\n",i,error,my_errno);
goto err;
}
......@@ -261,8 +326,19 @@ static int run_test(const char *filename)
}
}
if ((error=read_with_pos(file,silent)))
if (testflag == 4)
goto end;
if (checkpoint == 4 && ma_checkpoint_execute(CHECKPOINT_MEDIUM, FALSE))
goto err;
if (maria_scan_init(file))
{
fprintf(stderr, "maria_scan_init failed\n");
goto err;
}
if ((error=read_with_pos(file)))
goto err;
maria_scan_end(file);
if (!silent)
printf("- Test maria_rkey then a sequence of maria_rnext_same\n");
......@@ -270,7 +346,8 @@ static int run_test(const char *filename)
create_record(record, nrecords*4/5);
print_record(record,0," search for\n");
if ((error=maria_rkey(file,read_record,0,record+1,0,HA_READ_MBR_INTERSECT)))
if ((error=maria_rkey(file,read_record,0,record+1,HA_WHOLE_KEY,
HA_READ_MBR_INTERSECT)))
{
printf("maria_rkey: %3d errno: %3d\n",error,my_errno);
goto err;
......@@ -330,6 +407,34 @@ static int run_test(const char *filename)
hrows= maria_records_in_range(file,0, &range, (key_range*) 0);
printf(" %ld rows\n", (long) hrows);
end:
maria_scan_end(file);
if (die_in_middle_of_transaction)
{
/* see similar code in ma_test2.c for comments */
switch (die_in_middle_of_transaction) {
case 1:
_ma_flush_table_files(file, MARIA_FLUSH_DATA | MARIA_FLUSH_INDEX,
FLUSH_RELEASE, FLUSH_RELEASE);
break;
case 2:
if (translog_flush(file->trn->undo_lsn))
goto err;
break;
case 3:
break;
case 4:
_ma_flush_table_files(file, MARIA_FLUSH_DATA, FLUSH_RELEASE,
FLUSH_RELEASE);
if (translog_flush(file->trn->undo_lsn))
goto err;
break;
}
printf("Dying on request without maria_commit()/maria_close()\n");
exit(0);
}
if (maria_commit(file))
goto err;
if (maria_close(file)) goto err;
maria_end();
my_end(MY_CHECK_ERROR);
......@@ -343,7 +448,7 @@ err:
static int read_with_pos (MARIA_HA * file,int silent)
static int read_with_pos (MARIA_HA * file)
{
int error;
int i;
......@@ -355,7 +460,7 @@ static int read_with_pos (MARIA_HA * file,int silent)
{
my_errno=0;
bzero((char*) read_record,MAX_REC_LENGTH);
error=maria_rrnd(file,read_record,i == 0 ? 0L : HA_OFFSET_ERROR);
error=maria_scan(file,read_record);
if (error)
{
if (error==HA_ERR_END_OF_FILE)
......@@ -467,6 +572,86 @@ static void create_record(uchar *record, uint rownr)
}
}
static struct my_option my_long_options[] =
{
{"checkpoint", 'H', "Checkpoint at specified stage", (uchar**) &checkpoint,
(uchar**) &checkpoint, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"checksum", 'c', "Undocumented",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifndef DBUG_OFF
{"debug", '#', "Undocumented",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"help", '?', "Display help and exit",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"row-fixed-size", 'S', "Fixed size records",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"rows-in-block", 'M', "Store rows in block format",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"silent", 's', "Undocumented",
(uchar**) &silent, (uchar**) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"testflag", 't', "Stop test at specified stage", (uchar**) &testflag,
(uchar**) &testflag, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"test-undo", 'A',
"Abort hard. Used for testing recovery with undo",
(uchar**) &die_in_middle_of_transaction,
(uchar**) &die_in_middle_of_transaction,
0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"transactional", 'T',
"Test in transactional mode. (Only works with block format)",
(uchar**) &transactional, (uchar**) &transactional, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument __attribute__((unused)))
{
switch(optid) {
case 'c':
create_flag|= HA_CREATE_CHECKSUM | HA_CREATE_PAGE_CHECKSUM;
break;
case 'M':
record_type= BLOCK_RECORD;
break;
case 'S':
record_type= STATIC_RECORD;
break;
case '#':
DBUG_PUSH(argument);
break;
case '?':
usage();
exit(1);
}
return 0;
}
/* Read options */
static void get_options(int argc, char *argv[])
{
int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
exit(ho_error);
return;
} /* get options */
static void usage()
{
printf("Usage: %s [options]\n\n", my_progname);
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
#else
int main(int argc __attribute__((unused)),char *argv[] __attribute__((unused)))
{
......
......@@ -70,7 +70,6 @@ extern int _ma_flush_table_files(MARIA_HA *info, uint flush_data_or_index,
int main(int argc,char *argv[])
{
MY_INIT(argv[0]);
my_init();
get_options(argc,argv);
maria_data_root= (char *)".";
/* Maria requires that we always have a page cache */
......
......@@ -45,27 +45,25 @@ static int _ma_ck_write_btree(register MARIA_HA *info, uint keynr,uchar *key,
static int _ma_ck_write_btree_with_log(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
uchar *key, uint key_length,
my_off_t *root, uint comp_flag);
static my_bool _ma_log_new(MARIA_HA *info, my_off_t page, uchar *buff,
uint page_length, uint key_nr, my_bool root_page);
static my_bool _ma_log_change(MARIA_HA *info, my_off_t page, uchar *buff,
uchar *key_pos, uint length);
static my_bool _ma_log_split(MARIA_HA *info, my_off_t page, uchar *buff,
static my_bool _ma_log_split(MARIA_HA *info, my_off_t page, const uchar *buff,
uint org_length, uint new_length,
uchar *key_pos,
const uchar *key_pos,
uint key_length, int move_length,
enum en_key_op prefix_or_suffix,
uchar *data, uint data_length,
const uchar *data, uint data_length,
uint changed_length);
static my_bool _ma_log_del_prefix(MARIA_HA *info, my_off_t page, uchar *buff,
static my_bool _ma_log_del_prefix(MARIA_HA *info, my_off_t page,
const uchar *buff,
uint org_length, uint new_length,
uchar *key_pos, uint key_length,
const uchar *key_pos, uint key_length,
int move_length);
static my_bool _ma_log_key_middle(MARIA_HA *info, my_off_t page, uchar *buff,
static my_bool _ma_log_key_middle(MARIA_HA *info, my_off_t page,
const uchar *buff,
uint new_length,
uint data_added_first,
uint data_changed_first,
uint data_deleted_last,
uchar *key_pos,
const uchar *key_pos,
uint key_length, int move_length);
/*
......@@ -396,57 +394,9 @@ static int _ma_ck_write_btree_with_log(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
error= _ma_ck_real_write_btree(info, keyinfo, key, key_length, &new_root,
comp_flag);
if (!error && share->now_transactional)
{
uchar log_data[LSN_STORE_SIZE + FILEID_STORE_SIZE +
KEY_NR_STORE_SIZE];
LEX_CUSTRING log_array[TRANSLOG_INTERNAL_PARTS + 2];
struct st_msg_to_write_hook_for_undo_key msg;
/* Save if we need to write a clr record */
info->key_write_undo_lsn[keyinfo->key_nr]= info->trn->undo_lsn;
lsn_store(log_data, info->trn->undo_lsn);
key_nr_store(log_data + LSN_STORE_SIZE + FILEID_STORE_SIZE,
keyinfo->key_nr);
key_length+= share->rec_reflength;
log_array[TRANSLOG_INTERNAL_PARTS + 0].str= log_data;
log_array[TRANSLOG_INTERNAL_PARTS + 0].length= sizeof(log_data);
log_array[TRANSLOG_INTERNAL_PARTS + 1].str= key_buff;
log_array[TRANSLOG_INTERNAL_PARTS + 1].length= key_length;
msg.root= root;
msg.value= new_root;
msg.auto_increment= 0;
if (share->base.auto_key == ((uint)keyinfo->key_nr + 1))
{
const HA_KEYSEG *keyseg= keyinfo->seg;
uchar *to= key_buff;
if (keyseg->flag & HA_SWAP_KEY)
{
/* We put key from log record to "data record" packing format... */
uchar reversed[HA_MAX_KEY_BUFF];
uchar *key_ptr= to;
uchar *key_end= key_ptr + keyseg->length;
to= reversed + keyseg->length;
do
{
*--to= *key_ptr++;
} while (key_ptr != key_end);
}
/* ... so that we can read it with: */
msg.auto_increment=
ma_retrieve_auto_increment(to, keyseg->type);
/* and write_hook_for_undo_key_insert() will pick this. */
}
if (translog_write_record(&lsn, LOGREC_UNDO_KEY_INSERT,
info->trn, info,
(translog_size_t)
log_array[TRANSLOG_INTERNAL_PARTS + 0].length +
key_length,
TRANSLOG_INTERNAL_PARTS + 2, log_array,
log_data + LSN_STORE_SIZE, &msg))
error= -1;
}
error=
_ma_write_undo_key_insert(info, keyinfo, key_buff, key_length,
root, new_root, &lsn);
else
{
*root= new_root;
......@@ -778,6 +728,12 @@ int _ma_insert(register MARIA_HA *info, register MARIA_KEYDEF *keyinfo,
DBUG_ASSERT((*b & 128) == 0);
#if HA_FT_MAXLEN >= 127
blen= mi_uint2korr(b); b+=2;
When you enable this code, as part of the MyISAM->Maria merge of
ChangeSet@1.2562, 2008-04-09 07:41:40+02:00, serg@janus.mylan +9 -0
restore ft2 functionality, fix bugs.
Then this will enable two-level fulltext index, which is not totally
recoverable yet.
So remove this text and inform Guilhem so that he fixes the issue.
#else
blen= *b++;
#endif
......@@ -1636,6 +1592,63 @@ void maria_end_bulk_insert(MARIA_HA *info)
Dedicated functions that generate log entries
****************************************************************************/
int _ma_write_undo_key_insert(MARIA_HA *info,
const MARIA_KEYDEF *keyinfo,
const uchar *key, uint key_length,
my_off_t *root, my_off_t new_root, LSN *res_lsn)
{
MARIA_SHARE *share= info->s;
uchar log_data[LSN_STORE_SIZE + FILEID_STORE_SIZE +
KEY_NR_STORE_SIZE];
LEX_CUSTRING log_array[TRANSLOG_INTERNAL_PARTS + 2];
struct st_msg_to_write_hook_for_undo_key msg;
/* Save if we need to write a clr record */
info->key_write_undo_lsn[keyinfo->key_nr]= info->trn->undo_lsn;
lsn_store(log_data, info->trn->undo_lsn);
key_nr_store(log_data + LSN_STORE_SIZE + FILEID_STORE_SIZE,
keyinfo->key_nr);
key_length+= share->rec_reflength;
log_array[TRANSLOG_INTERNAL_PARTS + 0].str= log_data;
log_array[TRANSLOG_INTERNAL_PARTS + 0].length= sizeof(log_data);
log_array[TRANSLOG_INTERNAL_PARTS + 1].str= key;
log_array[TRANSLOG_INTERNAL_PARTS + 1].length= key_length;
msg.root= root;
msg.value= new_root;
msg.auto_increment= 0;
if (share->base.auto_key == ((uint)keyinfo->key_nr + 1))
{
const HA_KEYSEG *keyseg= keyinfo->seg;
if (keyseg->flag & HA_SWAP_KEY)
{
/* We put key from log record to "data record" packing format... */
uchar reversed[HA_MAX_KEY_BUFF];
const uchar *key_ptr= key, *key_end= key + keyseg->length;
uchar *to= reversed + keyseg->length;
do
{
*--to= *key_ptr++;
} while (key_ptr != key_end);
key= to;
}
/* ... so that we can read it with: */
msg.auto_increment=
ma_retrieve_auto_increment(key, keyseg->type);
/* and write_hook_for_undo_key_insert() will pick this. */
}
return translog_write_record(res_lsn, LOGREC_UNDO_KEY_INSERT,
info->trn, info,
(translog_size_t)
log_array[TRANSLOG_INTERNAL_PARTS + 0].length +
key_length,
TRANSLOG_INTERNAL_PARTS + 2, log_array,
log_data + LSN_STORE_SIZE, &msg) ? -1 : 0;
}
/**
@brief Log creation of new page
......@@ -1647,8 +1660,8 @@ void maria_end_bulk_insert(MARIA_HA *info)
@retval 0 ok
*/
static my_bool _ma_log_new(MARIA_HA *info, my_off_t page, uchar *buff,
uint page_length, uint key_nr, my_bool root_page)
my_bool _ma_log_new(MARIA_HA *info, my_off_t page, const uchar *buff,
uint page_length, uint key_nr, my_bool root_page)
{
LSN lsn;
uchar log_data[FILEID_STORE_SIZE + PAGE_STORE_SIZE * 2 + KEY_NR_STORE_SIZE
......@@ -1698,15 +1711,15 @@ static my_bool _ma_log_new(MARIA_HA *info, my_off_t page, uchar *buff,
Log when some part of the key page changes
*/
static my_bool _ma_log_change(MARIA_HA *info, my_off_t page, uchar *buff,
uchar *key_pos, uint length)
my_bool _ma_log_change(MARIA_HA *info, my_off_t page, const uchar *buff,
const uchar *key_pos, uint length)
{
LSN lsn;
uchar log_data[FILEID_STORE_SIZE + PAGE_STORE_SIZE + 6], *log_pos;
LEX_CUSTRING log_array[TRANSLOG_INTERNAL_PARTS + 2];
uint offset= (uint) (key_pos - buff);
uchar log_data[FILEID_STORE_SIZE + PAGE_STORE_SIZE + 6 + 7], *log_pos;
LEX_CUSTRING log_array[TRANSLOG_INTERNAL_PARTS + 3];
uint offset= (uint) (key_pos - buff), translog_parts, extra_length= 0;
DBUG_ENTER("_ma_log_change");
DBUG_PRINT("enter", ("page: %lu", (ulong) page));
DBUG_PRINT("enter", ("page: %lu length: %u", (ulong) page, length));
DBUG_ASSERT(info->s->now_transactional);
......@@ -1720,15 +1733,33 @@ static my_bool _ma_log_change(MARIA_HA *info, my_off_t page, uchar *buff,
int2store(log_pos+4, length);
log_array[TRANSLOG_INTERNAL_PARTS + 0].str= log_data;
log_array[TRANSLOG_INTERNAL_PARTS + 0].length= sizeof(log_data);
log_array[TRANSLOG_INTERNAL_PARTS + 1].str= buff + offset;
log_array[TRANSLOG_INTERNAL_PARTS + 0].length= sizeof(log_data) - 7;
log_array[TRANSLOG_INTERNAL_PARTS + 1].str= key_pos;
log_array[TRANSLOG_INTERNAL_PARTS + 1].length= length;
translog_parts= 2;
#ifdef EXTRA_DEBUG_KEY_CHANGES
{
int page_length= _ma_get_page_used(info->s, buff);
ha_checksum crc;
crc= my_checksum(0, buff + LSN_STORE_SIZE, page_length - LSN_STORE_SIZE);
log_pos+= 6;
log_pos[0]= KEY_OP_CHECK;
int2store(log_pos+1, page_length);
int4store(log_pos+3, crc);
log_array[TRANSLOG_INTERNAL_PARTS + translog_parts].str= (char *) log_pos;
log_array[TRANSLOG_INTERNAL_PARTS + translog_parts].length= 7;
extra_length+= 7;
translog_parts++;
}
#endif
if (translog_write_record(&lsn, LOGREC_REDO_INDEX,
info->trn, info,
(translog_size_t) (sizeof(log_data) + length),
TRANSLOG_INTERNAL_PARTS + 2, log_array,
log_data, NULL))
(translog_size_t) (sizeof(log_data) - 7 + length +
extra_length),
TRANSLOG_INTERNAL_PARTS + translog_parts,
log_array, log_data, NULL))
DBUG_RETURN(1);
DBUG_RETURN(0);
}
......@@ -1750,11 +1781,11 @@ static my_bool _ma_log_change(MARIA_HA *info, my_off_t page, uchar *buff,
*/
static my_bool _ma_log_split(MARIA_HA *info, my_off_t page, uchar *buff,
static my_bool _ma_log_split(MARIA_HA *info, my_off_t page, const uchar *buff,
uint org_length, uint new_length,
uchar *key_pos, uint key_length, int move_length,
enum en_key_op prefix_or_suffix,
uchar *data, uint data_length,
const uchar *key_pos, uint key_length,
int move_length, enum en_key_op prefix_or_suffix,
const uchar *data, uint data_length,
uint changed_length)
{
LSN lsn;
......@@ -1885,9 +1916,10 @@ static my_bool _ma_log_split(MARIA_HA *info, my_off_t page, uchar *buff,
@retval 1 error
*/
static my_bool _ma_log_del_prefix(MARIA_HA *info, my_off_t page, uchar *buff,
static my_bool _ma_log_del_prefix(MARIA_HA *info, my_off_t page,
const uchar *buff,
uint org_length, uint new_length,
uchar *key_pos, uint key_length,
const uchar *key_pos, uint key_length,
int move_length)
{
LSN lsn;
......@@ -1973,12 +2005,13 @@ static my_bool _ma_log_del_prefix(MARIA_HA *info, my_off_t page, uchar *buff,
data deleted last. Old changed key may be part of page
*/
static my_bool _ma_log_key_middle(MARIA_HA *info, my_off_t page, uchar *buff,
static my_bool _ma_log_key_middle(MARIA_HA *info, my_off_t page,
const uchar *buff,
uint new_length,
uint data_added_first,
uint data_changed_first,
uint data_deleted_last,
uchar *key_pos,
const uchar *key_pos,
uint key_length, int move_length)
{
LSN lsn;
......@@ -2084,7 +2117,7 @@ static my_bool _ma_log_key_middle(MARIA_HA *info, my_off_t page, uchar *buff,
*/
static my_bool _ma_log_middle(MARIA_HA *info, my_off_t page,
uchar *buff,
const uchar *buff,
uint data_added_first, uint data_changed_first,
uint data_deleted_last)
{
......
......@@ -267,7 +267,7 @@ static void get_options(int *argc,char ***argv)
if (!opt_apply)
opt_apply_undo= FALSE;
if ((opt_display_only + opt_apply) != 1)
if (((opt_display_only + opt_apply) != 1) || (*argc > 0))
{
usage();
exit(1);
......
......@@ -105,7 +105,7 @@ static int run_test(const char *filename)
int nrecords=sizeof(rt_data)/(sizeof(double)*4);/* 3000;*/
int rec_length=0;
int uniques=0;
int i;
int i, max_i;
int error;
int row_count=0;
uchar record[MAX_REC_LENGTH];
......@@ -194,7 +194,7 @@ static int run_test(const char *filename)
create_record(record,i);
bzero((char*) read_record,MAX_REC_LENGTH);
error=mi_rkey(file,read_record,0,record+1,0,HA_READ_MBR_EQUAL);
error=mi_rkey(file,read_record,0,record+1,HA_WHOLE_KEY,HA_READ_MBR_EQUAL);
if (error && error!=HA_ERR_KEY_NOT_FOUND)
{
......@@ -233,7 +233,8 @@ static int run_test(const char *filename)
if (!silent)
printf("- Updating rows with position\n");
for (i=0; i < (nrecords - nrecords/4) ; i++)
/* We are looking for nrecords-necords/2 non-deleted records */
for (i=0, max_i= nrecords - nrecords/2; i < max_i ; i++)
{
my_errno=0;
bzero((char*) read_record,MAX_REC_LENGTH);
......@@ -241,7 +242,11 @@ static int run_test(const char *filename)
if (error)
{
if (error==HA_ERR_RECORD_DELETED)
{
printf("found deleted record\n");
max_i++; /* don't count such record */
continue;
}
printf("pos: %2d mi_rrnd: %3d errno: %3d\n",i,error,my_errno);
goto err;
}
......@@ -266,7 +271,8 @@ static int run_test(const char *filename)
create_record(record, nrecords*4/5);
print_record(record,0," search for\n");
if ((error=mi_rkey(file,read_record,0,record+1,0,HA_READ_MBR_INTERSECT)))
if ((error=mi_rkey(file,read_record,0,record+1,HA_WHOLE_KEY,
HA_READ_MBR_INTERSECT)))
{
printf("mi_rkey: %3d errno: %3d\n",error,my_errno);
goto err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment