Merge with 5.1-bugteam.

This commit is contained in:
Jim Winstead 2009-05-05 10:29:01 -07:00
commit ce33c94849
64 changed files with 1118 additions and 711 deletions

View File

@ -46,4 +46,12 @@ master-bin.000001 1137 Query 1 1216 use `test`; DROP TABLE t4
End of 5.0 tests End of 5.0 tests
SHOW BINLOG EVENTS FROM 364; SHOW BINLOG EVENTS FROM 364;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment.
CREATE TABLE t1 (a varchar(16)) character set cp932;
INSERT INTO t1 VALUES (0x8372835E),(0x8352835E);
SELECT hex(a), hex(lower(a)), hex(upper(a)) FROM t1 ORDER BY binary(a);
hex(a) hex(lower(a)) hex(upper(a))
8352835E 8352835E 8352835E
8372835E 8372835E 8372835E
DROP TABLE t1;
End of 5.1 tests End of 5.1 tests

View File

@ -209,3 +209,13 @@ SET NAMES sjis;
SELECT HEX('佐淘 圭') FROM DUAL; SELECT HEX('佐淘 圭') FROM DUAL;
HEX('佐淘 圭') HEX('佐淘 圭')
8DB2939181408C5C 8DB2939181408C5C
# Start of 5.1 tests
Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment.
CREATE TABLE t1 (a varchar(16)) character set sjis;
INSERT INTO t1 VALUES (0x8372835E),(0x8352835E);
SELECT hex(a), hex(lower(a)), hex(upper(a)) FROM t1 ORDER BY binary(a);
hex(a) hex(lower(a)) hex(upper(a))
8352835E 8352835E 8352835E
8372835E 8372835E 8372835E
DROP TABLE t1;
# End of 5.1 tests

View File

@ -535,3 +535,11 @@ CREATE TABLE t1(a TEXT);
SELECT GROUP_CONCAT(a) AS st FROM t1 HAVING MATCH(st) AGAINST('test' IN BOOLEAN MODE); SELECT GROUP_CONCAT(a) AS st FROM t1 HAVING MATCH(st) AGAINST('test' IN BOOLEAN MODE);
ERROR HY000: Incorrect arguments to AGAINST ERROR HY000: Incorrect arguments to AGAINST
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1(a VARCHAR(64), FULLTEXT(a));
INSERT INTO t1 VALUES('awrd bwrd cwrd'),('awrd bwrd cwrd'),('awrd bwrd cwrd');
SELECT * FROM t1 WHERE MATCH(a) AGAINST('+awrd bwrd* +cwrd*' IN BOOLEAN MODE);
a
awrd bwrd cwrd
awrd bwrd cwrd
awrd bwrd cwrd
DROP TABLE t1;

View File

@ -186,106 +186,106 @@ CREATE TABLE t2 (
fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY, fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
g GEOMETRY NOT NULL g GEOMETRY NOT NULL
) ENGINE=MyISAM; ) ENGINE=MyISAM;
INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10)))); INSERT INTO t2 (g) VALUES (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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)))); INSERT INTO t2 (g) VALUES (LineString(Point(1 * 10 - 9, 1 * 10 - 9), Point(1 * 10, 1 * 10)));
ALTER TABLE t2 ADD SPATIAL KEY(g); ALTER TABLE t2 ADD SPATIAL KEY(g);
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
@ -309,406 +309,406 @@ fid AsText(g)
56 LINESTRING(41 41,50 50) 56 LINESTRING(41 41,50 50)
45 LINESTRING(51 51,60 60) 45 LINESTRING(51 51,60 60)
55 LINESTRING(41 51,50 60) 55 LINESTRING(41 51,50 60)
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 10 * 10 - 9), Point(10 * 10, 10 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
99 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 9 * 10 - 9), Point(10 * 10, 9 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 9 * 10 - 9), Point(10 * 10, 9 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
98 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 8 * 10 - 9), Point(10 * 10, 8 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 8 * 10 - 9), Point(10 * 10, 8 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
97 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 7 * 10 - 9), Point(10 * 10, 7 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 7 * 10 - 9), Point(10 * 10, 7 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
96 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 6 * 10 - 9), Point(10 * 10, 6 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 6 * 10 - 9), Point(10 * 10, 6 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
95 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 5 * 10 - 9), Point(10 * 10, 5 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 5 * 10 - 9), Point(10 * 10, 5 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
94 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 4 * 10 - 9), Point(10 * 10, 4 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 4 * 10 - 9), Point(10 * 10, 4 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
93 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 3 * 10 - 9), Point(10 * 10, 3 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 3 * 10 - 9), Point(10 * 10, 3 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
92 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 2 * 10 - 9), Point(10 * 10, 2 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 2 * 10 - 9), Point(10 * 10, 2 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
91 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(10 * 10 - 9, 1 * 10 - 9), Point(10 * 10, 1 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(10 * 10 - 9, 1 * 10 - 9), Point(10 * 10, 1 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
90 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 10 * 10 - 9), Point(9 * 10, 10 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 10 * 10 - 9), Point(9 * 10, 10 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
89 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 9 * 10 - 9), Point(9 * 10, 9 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 9 * 10 - 9), Point(9 * 10, 9 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
88 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 8 * 10 - 9), Point(9 * 10, 8 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 8 * 10 - 9), Point(9 * 10, 8 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
87 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 7 * 10 - 9), Point(9 * 10, 7 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 7 * 10 - 9), Point(9 * 10, 7 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
86 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 6 * 10 - 9), Point(9 * 10, 6 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 6 * 10 - 9), Point(9 * 10, 6 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
85 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 5 * 10 - 9), Point(9 * 10, 5 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 5 * 10 - 9), Point(9 * 10, 5 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
84 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 4 * 10 - 9), Point(9 * 10, 4 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 4 * 10 - 9), Point(9 * 10, 4 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
83 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 3 * 10 - 9), Point(9 * 10, 3 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 3 * 10 - 9), Point(9 * 10, 3 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
82 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 2 * 10 - 9), Point(9 * 10, 2 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 2 * 10 - 9), Point(9 * 10, 2 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
81 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(9 * 10 - 9, 1 * 10 - 9), Point(9 * 10, 1 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(9 * 10 - 9, 1 * 10 - 9), Point(9 * 10, 1 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
80 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 10 * 10 - 9), Point(8 * 10, 10 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 10 * 10 - 9), Point(8 * 10, 10 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
79 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 9 * 10 - 9), Point(8 * 10, 9 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 9 * 10 - 9), Point(8 * 10, 9 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
78 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 8 * 10 - 9), Point(8 * 10, 8 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 8 * 10 - 9), Point(8 * 10, 8 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
77 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 7 * 10 - 9), Point(8 * 10, 7 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 7 * 10 - 9), Point(8 * 10, 7 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
76 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 6 * 10 - 9), Point(8 * 10, 6 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 6 * 10 - 9), Point(8 * 10, 6 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
75 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 5 * 10 - 9), Point(8 * 10, 5 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 5 * 10 - 9), Point(8 * 10, 5 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
74 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 4 * 10 - 9), Point(8 * 10, 4 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 4 * 10 - 9), Point(8 * 10, 4 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
73 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 3 * 10 - 9), Point(8 * 10, 3 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 3 * 10 - 9), Point(8 * 10, 3 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
72 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 2 * 10 - 9), Point(8 * 10, 2 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 2 * 10 - 9), Point(8 * 10, 2 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
71 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(8 * 10 - 9, 1 * 10 - 9), Point(8 * 10, 1 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(8 * 10 - 9, 1 * 10 - 9), Point(8 * 10, 1 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
70 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 10 * 10 - 9), Point(7 * 10, 10 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 10 * 10 - 9), Point(7 * 10, 10 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
69 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 9 * 10 - 9), Point(7 * 10, 9 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 9 * 10 - 9), Point(7 * 10, 9 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
68 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 8 * 10 - 9), Point(7 * 10, 8 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 8 * 10 - 9), Point(7 * 10, 8 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
67 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 7 * 10 - 9), Point(7 * 10, 7 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 7 * 10 - 9), Point(7 * 10, 7 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
66 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 6 * 10 - 9), Point(7 * 10, 6 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 6 * 10 - 9), Point(7 * 10, 6 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
65 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 5 * 10 - 9), Point(7 * 10, 5 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 5 * 10 - 9), Point(7 * 10, 5 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
64 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 4 * 10 - 9), Point(7 * 10, 4 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 4 * 10 - 9), Point(7 * 10, 4 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
63 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 3 * 10 - 9), Point(7 * 10, 3 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 3 * 10 - 9), Point(7 * 10, 3 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
62 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 2 * 10 - 9), Point(7 * 10, 2 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 2 * 10 - 9), Point(7 * 10, 2 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
61 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(7 * 10 - 9, 1 * 10 - 9), Point(7 * 10, 1 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(7 * 10 - 9, 1 * 10 - 9), Point(7 * 10, 1 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
60 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 10 * 10 - 9), Point(6 * 10, 10 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 10 * 10 - 9), Point(6 * 10, 10 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
59 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 9 * 10 - 9), Point(6 * 10, 9 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 9 * 10 - 9), Point(6 * 10, 9 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
58 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 8 * 10 - 9), Point(6 * 10, 8 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 8 * 10 - 9), Point(6 * 10, 8 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
57 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 7 * 10 - 9), Point(6 * 10, 7 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 7 * 10 - 9), Point(6 * 10, 7 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
56 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 6 * 10 - 9), Point(6 * 10, 6 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 6 * 10 - 9), Point(6 * 10, 6 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
55 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 5 * 10 - 9), Point(6 * 10, 5 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 5 * 10 - 9), Point(6 * 10, 5 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
54 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 4 * 10 - 9), Point(6 * 10, 4 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 4 * 10 - 9), Point(6 * 10, 4 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
53 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 3 * 10 - 9), Point(6 * 10, 3 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 3 * 10 - 9), Point(6 * 10, 3 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
52 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 2 * 10 - 9), Point(6 * 10, 2 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 2 * 10 - 9), Point(6 * 10, 2 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
51 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(6 * 10 - 9, 1 * 10 - 9), Point(6 * 10, 1 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(6 * 10 - 9, 1 * 10 - 9), Point(6 * 10, 1 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
50 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 10 * 10 - 9), Point(5 * 10, 10 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 10 * 10 - 9), Point(5 * 10, 10 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
49 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 9 * 10 - 9), Point(5 * 10, 9 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 9 * 10 - 9), Point(5 * 10, 9 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
48 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 8 * 10 - 9), Point(5 * 10, 8 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 8 * 10 - 9), Point(5 * 10, 8 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
47 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 7 * 10 - 9), Point(5 * 10, 7 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 7 * 10 - 9), Point(5 * 10, 7 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
46 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 6 * 10 - 9), Point(5 * 10, 6 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 6 * 10 - 9), Point(5 * 10, 6 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
45 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 5 * 10 - 9), Point(5 * 10, 5 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 5 * 10 - 9), Point(5 * 10, 5 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
44 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 4 * 10 - 9), Point(5 * 10, 4 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 4 * 10 - 9), Point(5 * 10, 4 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
43 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 3 * 10 - 9), Point(5 * 10, 3 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 3 * 10 - 9), Point(5 * 10, 3 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
42 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 2 * 10 - 9), Point(5 * 10, 2 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 2 * 10 - 9), Point(5 * 10, 2 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
41 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(5 * 10 - 9, 1 * 10 - 9), Point(5 * 10, 1 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(5 * 10 - 9, 1 * 10 - 9), Point(5 * 10, 1 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
40 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 10 * 10 - 9), Point(4 * 10, 10 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 10 * 10 - 9), Point(4 * 10, 10 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
39 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 9 * 10 - 9), Point(4 * 10, 9 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 9 * 10 - 9), Point(4 * 10, 9 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
38 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 8 * 10 - 9), Point(4 * 10, 8 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 8 * 10 - 9), Point(4 * 10, 8 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
37 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 7 * 10 - 9), Point(4 * 10, 7 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 7 * 10 - 9), Point(4 * 10, 7 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
36 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 6 * 10 - 9), Point(4 * 10, 6 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 6 * 10 - 9), Point(4 * 10, 6 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
35 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 5 * 10 - 9), Point(4 * 10, 5 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 5 * 10 - 9), Point(4 * 10, 5 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
34 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 4 * 10 - 9), Point(4 * 10, 4 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 4 * 10 - 9), Point(4 * 10, 4 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
33 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 3 * 10 - 9), Point(4 * 10, 3 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 3 * 10 - 9), Point(4 * 10, 3 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
32 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 2 * 10 - 9), Point(4 * 10, 2 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 2 * 10 - 9), Point(4 * 10, 2 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
31 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(4 * 10 - 9, 1 * 10 - 9), Point(4 * 10, 1 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(4 * 10 - 9, 1 * 10 - 9), Point(4 * 10, 1 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
30 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 10 * 10 - 9), Point(3 * 10, 10 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 10 * 10 - 9), Point(3 * 10, 10 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
29 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 9 * 10 - 9), Point(3 * 10, 9 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 9 * 10 - 9), Point(3 * 10, 9 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
28 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 8 * 10 - 9), Point(3 * 10, 8 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 8 * 10 - 9), Point(3 * 10, 8 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
27 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 7 * 10 - 9), Point(3 * 10, 7 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 7 * 10 - 9), Point(3 * 10, 7 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
26 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 6 * 10 - 9), Point(3 * 10, 6 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 6 * 10 - 9), Point(3 * 10, 6 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
25 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 5 * 10 - 9), Point(3 * 10, 5 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 5 * 10 - 9), Point(3 * 10, 5 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
24 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 4 * 10 - 9), Point(3 * 10, 4 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 4 * 10 - 9), Point(3 * 10, 4 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
23 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 3 * 10 - 9), Point(3 * 10, 3 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 3 * 10 - 9), Point(3 * 10, 3 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
22 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 2 * 10 - 9), Point(3 * 10, 2 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 2 * 10 - 9), Point(3 * 10, 2 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
21 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(3 * 10 - 9, 1 * 10 - 9), Point(3 * 10, 1 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(3 * 10 - 9, 1 * 10 - 9), Point(3 * 10, 1 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
20 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 10 * 10 - 9), Point(2 * 10, 10 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 10 * 10 - 9), Point(2 * 10, 10 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
19 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 9 * 10 - 9), Point(2 * 10, 9 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 9 * 10 - 9), Point(2 * 10, 9 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
18 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 8 * 10 - 9), Point(2 * 10, 8 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 8 * 10 - 9), Point(2 * 10, 8 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
17 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 7 * 10 - 9), Point(2 * 10, 7 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 7 * 10 - 9), Point(2 * 10, 7 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
16 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 6 * 10 - 9), Point(2 * 10, 6 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 6 * 10 - 9), Point(2 * 10, 6 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
15 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 5 * 10 - 9), Point(2 * 10, 5 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 5 * 10 - 9), Point(2 * 10, 5 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
14 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 4 * 10 - 9), Point(2 * 10, 4 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 4 * 10 - 9), Point(2 * 10, 4 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
13 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 3 * 10 - 9), Point(2 * 10, 3 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 3 * 10 - 9), Point(2 * 10, 3 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
12 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 2 * 10 - 9), Point(2 * 10, 2 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 2 * 10 - 9), Point(2 * 10, 2 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
11 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(2 * 10 - 9, 1 * 10 - 9), Point(2 * 10, 1 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(2 * 10 - 9, 1 * 10 - 9), Point(2 * 10, 1 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
10 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 10 * 10 - 9), Point(1 * 10, 10 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 10 * 10 - 9), Point(1 * 10, 10 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
9 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 9 * 10 - 9), Point(1 * 10, 9 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 9 * 10 - 9), Point(1 * 10, 9 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
8 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 8 * 10 - 9), Point(1 * 10, 8 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 8 * 10 - 9), Point(1 * 10, 8 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
7 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 7 * 10 - 9), Point(1 * 10, 7 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 7 * 10 - 9), Point(1 * 10, 7 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
6 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 6 * 10 - 9), Point(1 * 10, 6 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 6 * 10 - 9), Point(1 * 10, 6 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
5 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 5 * 10 - 9), Point(1 * 10, 5 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 5 * 10 - 9), Point(1 * 10, 5 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
4 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 4 * 10 - 9), Point(1 * 10, 4 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 4 * 10 - 9), Point(1 * 10, 4 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
3 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 3 * 10 - 9), Point(1 * 10, 3 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 3 * 10 - 9), Point(1 * 10, 3 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
2 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 2 * 10 - 9), Point(1 * 10, 2 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 2 * 10 - 9), Point(1 * 10, 2 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
1 100
DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point(1 * 10 - 9, 1 * 10 - 9), Point(1 * 10, 1 * 10))))); DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point(1 * 10 - 9, 1 * 10 - 9), Point(1 * 10, 1 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
count(*) count(*)
0 100
DROP TABLE t2; DROP TABLE t2;
drop table if exists t1; drop table if exists t1;
Warnings: Warnings:
@ -863,11 +863,11 @@ Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) ); CREATE TABLE t1 (foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) );
INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(1,1))); INSERT INTO t1 (foo) VALUES (POINT(1,1));
INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(1,0))); INSERT INTO t1 (foo) VALUES (POINT(1,0));
INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(0,1))); INSERT INTO t1 (foo) VALUES (POINT(0,1));
INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(0,0))); INSERT INTO t1 (foo) VALUES (POINT(0,0));
SELECT 1 FROM t1 WHERE foo != PointFromWKB(POINT(0,0)); SELECT 1 FROM t1 WHERE foo != POINT(0,0);
1 1
1 1
1 1
@ -1426,35 +1426,35 @@ Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK
DROP TABLE t1; DROP TABLE t1;
create table t1 (a geometry not null, spatial index(a)); create table t1 (a geometry not null, spatial index(a));
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 131072))); insert into t1 values (POINT(1.1517219314031e+164, 131072));
insert into t1 values (PointFromWKB(POINT(9.1248812352444e+192, 2.9740338169556e+284))); insert into t1 values (POINT(9.1248812352444e+192, 2.9740338169556e+284));
insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, -0))); insert into t1 values (POINT(4.7783097267365e-299, -0));
insert into t1 values (PointFromWKB(POINT(1.49166814624e-154, 2.0880974297595e-53))); insert into t1 values (POINT(1.49166814624e-154, 2.0880974297595e-53));
insert into t1 values (PointFromWKB(POINT(4.0917382598702e+149, 1.2024538023802e+111))); insert into t1 values (POINT(4.0917382598702e+149, 1.2024538023802e+111));
insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 2.9993936277913e-241))); insert into t1 values (POINT(2.0349165139404e+236, 2.9993936277913e-241));
insert into t1 values (PointFromWKB(POINT(2.5243548967072e-29, 1.2024538023802e+111))); insert into t1 values (POINT(2.5243548967072e-29, 1.2024538023802e+111));
insert into t1 values (PointFromWKB(POINT(0, 6.9835074892995e-251))); insert into t1 values (POINT(0, 6.9835074892995e-251));
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 3.1050361846014e+231))); insert into t1 values (POINT(2.0880974297595e-53, 3.1050361846014e+231));
insert into t1 values (PointFromWKB(POINT(2.8728483499323e-188, 2.4600631144627e+260))); insert into t1 values (POINT(2.8728483499323e-188, 2.4600631144627e+260));
insert into t1 values (PointFromWKB(POINT(3.0517578125e-05, 2.0349165139404e+236))); insert into t1 values (POINT(3.0517578125e-05, 2.0349165139404e+236));
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 1.1818212630766e-125))); insert into t1 values (POINT(1.1517219314031e+164, 1.1818212630766e-125));
insert into t1 values (PointFromWKB(POINT(2.481040258324e-265, 5.7766220027675e-275))); insert into t1 values (POINT(2.481040258324e-265, 5.7766220027675e-275));
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 2.5243548967072e-29))); insert into t1 values (POINT(2.0880974297595e-53, 2.5243548967072e-29));
insert into t1 values (PointFromWKB(POINT(5.7766220027675e-275, 9.9464647281957e+86))); insert into t1 values (POINT(5.7766220027675e-275, 9.9464647281957e+86));
insert into t1 values (PointFromWKB(POINT(2.2181357552967e+130, 3.7857669957337e-270))); insert into t1 values (POINT(2.2181357552967e+130, 3.7857669957337e-270));
insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.6893488147419e+19))); insert into t1 values (POINT(4.5767114681874e-246, 3.6893488147419e+19));
insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.7537584144024e+255))); insert into t1 values (POINT(4.5767114681874e-246, 3.7537584144024e+255));
insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 1.8033161362863e-130))); insert into t1 values (POINT(3.7857669957337e-270, 1.8033161362863e-130));
insert into t1 values (PointFromWKB(POINT(0, 5.8774717541114e-39))); insert into t1 values (POINT(0, 5.8774717541114e-39));
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 2.2761049594727e-159))); insert into t1 values (POINT(1.1517219314031e+164, 2.2761049594727e-159));
insert into t1 values (PointFromWKB(POINT(6.243497100632e+144, 3.7857669957337e-270))); insert into t1 values (POINT(6.243497100632e+144, 3.7857669957337e-270));
insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 2.6355494858076e-82))); insert into t1 values (POINT(3.7857669957337e-270, 2.6355494858076e-82));
insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 3.8518598887745e-34))); insert into t1 values (POINT(2.0349165139404e+236, 3.8518598887745e-34));
insert into t1 values (PointFromWKB(POINT(4.6566128730774e-10, 2.0880974297595e-53))); insert into t1 values (POINT(4.6566128730774e-10, 2.0880974297595e-53));
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 1.8827498946116e-183))); insert into t1 values (POINT(2.0880974297595e-53, 1.8827498946116e-183));
insert into t1 values (PointFromWKB(POINT(1.8033161362863e-130, 9.1248812352444e+192))); insert into t1 values (POINT(1.8033161362863e-130, 9.1248812352444e+192));
insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, 2.2761049594727e-159))); insert into t1 values (POINT(4.7783097267365e-299, 2.2761049594727e-159));
insert into t1 values (PointFromWKB(POINT(1.94906280228e+289, 1.2338789709327e-178))); insert into t1 values (POINT(1.94906280228e+289, 1.2338789709327e-178));
drop table t1; drop table t1;
CREATE TABLE t1(foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) ); CREATE TABLE t1(foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) );
INSERT INTO t1(foo) VALUES (NULL); INSERT INTO t1(foo) VALUES (NULL);

View File

@ -47,26 +47,26 @@ INSERT INTO gis_point VALUES
INSERT INTO gis_line VALUES INSERT INTO gis_line VALUES
(105, LineFromText('LINESTRING(0 0,0 10,10 0)')), (105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')), (106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
(107, LineStringFromWKB(LineString(Point(10, 10), Point(40, 10)))); (107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));
INSERT INTO gis_polygon VALUES INSERT INTO gis_polygon VALUES
(108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')), (108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
(109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')), (109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
(110, PolyFromWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))); (110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))));
INSERT INTO gis_multi_point VALUES INSERT INTO gis_multi_point VALUES
(111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')), (111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
(112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')), (112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
(113, MPointFromWKB(MultiPoint(Point(3, 6), Point(4, 10)))); (113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));
INSERT INTO gis_multi_line VALUES INSERT INTO gis_multi_line VALUES
(114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')), (114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
(115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')), (115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
(116, MLineFromWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))); (116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))));
INSERT INTO gis_multi_polygon VALUES INSERT INTO gis_multi_polygon VALUES
(117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), (117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
(118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), (118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
(119, MPolyFromWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))); (119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
INSERT INTO gis_geometrycollection VALUES INSERT INTO gis_geometrycollection VALUES
(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')), (120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
(121, GeometryFromWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9))))); (121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9))))));
INSERT into gis_geometry SELECT * FROM gis_point; INSERT into gis_geometry SELECT * FROM gis_point;
INSERT into gis_geometry SELECT * FROM gis_line; INSERT into gis_geometry SELECT * FROM gis_line;
INSERT into gis_geometry SELECT * FROM gis_polygon; INSERT into gis_geometry SELECT * FROM gis_polygon;

View File

@ -765,6 +765,11 @@ f1 f2
2 2 2 2
10 10 10 10
DROP TABLE t1, t2; DROP TABLE t1, t2;
CREATE TABLE t1 ( a INT KEY, b INT );
INSERT INTO t1 VALUES ( 0, 1 );
INSERT INTO t1 ( b ) SELECT MAX( b ) FROM t1 WHERE b = 2;
ERROR 23000: Duplicate entry '0' for key 'PRIMARY'
DROP TABLE t1;
SET SQL_MODE='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'; SET SQL_MODE='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
CREATE TABLE t1 (c VARCHAR(30), INDEX ix_c (c(10))); CREATE TABLE t1 (c VARCHAR(30), INDEX ix_c (c(10)));
CREATE TABLE t2 (d VARCHAR(10)); CREATE TABLE t2 (d VARCHAR(10));

View File

@ -2226,4 +2226,30 @@ Key Start Len Index Type
1 2 30 multip. varchar 1 2 30 multip. varchar
2 33 30 multip. char NULL 2 33 30 multip. char NULL
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (
c INT,
d bit(1),
e INT,
f VARCHAR(1),
g BIT(1),
h BIT(1),
KEY (h, d, e, g)
);
INSERT INTO t1 VALUES
( 3, 1, 1, 'a', 0, 0 ),
( 3, 1, 5, 'a', 0, 0 ),
( 10, 1, 2, 'a', 0, 1 ),
( 10, 1, 3, 'a', 0, 1 ),
( 10, 1, 4, 'a', 0, 1 );
SELECT f FROM t1 WHERE d = 1 AND e = 2 AND g = 0 AND h = 1;
f
a
SELECT h+0, d + 0, e, g + 0 FROM t1;
h+0 d + 0 e g + 0
0 1 1 0
0 1 5 0
1 1 2 0
1 1 3 0
1 1 4 0
DROP TABLE t1;
End of 5.1 tests End of 5.1 tests

View File

@ -0,0 +1,39 @@
#
# BUG#40827 - Killing insert-select to MyISAM can cause table corruption
#
CREATE TABLE `t1` (
`id` BIGINT(20) ,
`id1` BIGINT(20) AUTO_INCREMENT,
KEY(id1), KEY(id)
) ENGINE=MyISAM;
CREATE TABLE `t2` (
`id` BIGINT(20) ,
`id1` BIGINT(20) AUTO_INCREMENT,
KEY (id1), KEY(id)
) ENGINE=MyISAM;
INSERT INTO t2 (id) VALUES (123);
INSERT INTO t2 (id) SELECT id FROM t2;
INSERT INTO t2 (id) SELECT id FROM t2;
INSERT INTO t2 (id) SELECT id FROM t2;
INSERT INTO t2 (id) SELECT id FROM t2;
INSERT INTO t2 (id) SELECT id FROM t2;
INSERT INTO t2 (id) SELECT id FROM t2;
INSERT INTO t2 (id) SELECT id FROM t2;
INSERT INTO t2 (id) SELECT id FROM t2;
INSERT INTO t2 (id) SELECT id FROM t2;
INSERT INTO t2 (id) SELECT id FROM t2;
# Switch to insert Connection
SET SESSION debug='+d,wait_in_enable_indexes';
# Send insert data
INSERT INTO t1(id) SELECT id FROM t2;
# Switch to default Connection
# Wait for insert data to reach the debug point
SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE STATE = 'wait_in_enable_indexes' AND
INFO = "INSERT INTO t1(id) SELECT id FROM t2"
INTO @thread_id;
KILL QUERY @thread_id;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1,t2;

View File

@ -6994,6 +6994,21 @@ select name from mysql.proc where name = 'p' and sql_mode = @full_mode;
name name
p p
drop procedure p; drop procedure p;
CREATE DEFINER = 'root'@'localhost' PROCEDURE p1()
NOT DETERMINISTIC
CONTAINS SQL
SQL SECURITY DEFINER
COMMENT ''
BEGIN
SHOW TABLE STATUS like 't1';
END;//
CREATE TABLE t1 (f1 INT);
CALL p1();
CALL p1();
CALL p1();
CALL p1();
DROP PROCEDURE p1;
DROP TABLE t1;
# ------------------------------------------------------------------ # ------------------------------------------------------------------
# -- End of 5.1 tests # -- End of 5.1 tests
# ------------------------------------------------------------------ # ------------------------------------------------------------------

View File

@ -849,6 +849,25 @@ ROW(1,2) = (SELECT 1, 1) ROW(1,2) IN (SELECT 1, 1)
SELECT ROW(1,2) = (SELECT 1, 2), ROW(1,2) IN (SELECT 1, 2); SELECT ROW(1,2) = (SELECT 1, 2), ROW(1,2) IN (SELECT 1, 2);
ROW(1,2) = (SELECT 1, 2) ROW(1,2) IN (SELECT 1, 2) ROW(1,2) = (SELECT 1, 2) ROW(1,2) IN (SELECT 1, 2)
1 1 1 1
CREATE TABLE t1 (a INT, b INT, c INT);
INSERT INTO t1 VALUES (1,1,1), (1,1,1);
EXPLAIN EXTENDED
SELECT c FROM
( SELECT
(SELECT COUNT(a) FROM
(SELECT COUNT(b) FROM t1) AS x GROUP BY c
) FROM t1 GROUP BY b
) AS y;
ERROR 42S22: Unknown column 'c' in 'field list'
SHOW WARNINGS;
Level Code Message
Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2
Note 1276 Field or reference 'test.t1.c' of SELECT #3 was resolved in SELECT #2
Error 1054 Unknown column 'c' in 'field list'
Note 1003 select `c` AS `c` from (select (select count(`test`.`t1`.`a`) AS `COUNT(a)` from (select count(`test`.`t1`.`b`) AS `COUNT(b)` from `test`.`t1`) `x` group by `c`) AS `(SELECT COUNT(a) FROM
(SELECT COUNT(b) FROM t1) AS x GROUP BY c
)` from `test`.`t1` group by `test`.`t1`.`b`) `y`
DROP TABLE t1;
End of 5.0 tests End of 5.0 tests
create table t0 (a int); create table t0 (a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);

View File

@ -57,6 +57,18 @@ s1
1 1
drop table `txu@0023p@0023p1`; drop table `txu@0023p@0023p1`;
drop table `txu#p#p1`; drop table `txu#p#p1`;
#
# Bug#37631 Incorrect key file for table after upgrading from 5.0 to 5.1
#
# copy table created using mysql4.0 into the data dir
# check the table created using mysql 4.0
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check error Table upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it!
# query the table created using mysql 4.0
SELECT * FROM t1;
c1 c2 c3
DROP TABLE t1;
truncate t1; truncate t1;
drop table t1; drop table t1;
drop database if exists `tabc`; drop database if exists `tabc`;

View File

Binary file not shown.

Binary file not shown.

View File

@ -83,4 +83,4 @@ sync_slave_with_master;
# will be created. You will need to go to the mysql-test dir and diff # will be created. You will need to go to the mysql-test dir and diff
# the files your self to see what is not matching # the files your self to see what is not matching
--exec diff $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql --diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql

View File

@ -0,0 +1,6 @@
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;

View File

@ -1 +0,0 @@
rm -f $MYSQLTEST_VARDIR/slave-data/master.info

View File

@ -0,0 +1 @@
--loose-debug=d,simulate_slave_delay_at_terminate_bug38694

View File

@ -0,0 +1,10 @@
# Testing replication threads stopping concurrency issue
# at the server shutdown
# Related bugs: bug#38694, bug#29968, bug#25306
# The test checks if a delay at the termination phase of slave threads
# DBUG_EXECUTE_IF("simulate_slave_delay_at_terminate_bug38694", sleep(5););
# could cause any issue.
source include/master-slave.inc;
# End of tests

View File

@ -14,42 +14,13 @@ REPLACE INTO t1 VALUES (4);
SELECT * FROM t1; SELECT * FROM t1;
connection slave; connection slave;
source include/wait_for_slave_sql_to_stop.inc; # Wait until SQL thread stops with error LOST_EVENT on master
let $slave_sql_errno= 1590;
source include/wait_for_slave_sql_error.inc;
# The 4 should not be inserted into the table, since the incident log # The 4 should not be inserted into the table, since the incident log
# event should have stop the slave. # event should have stop the slave.
--echo **** On Slave **** --echo **** On Slave ****
#### BEGIN DEBUG INFO ADDED BY SVEN 2008-07-18 -- SEE BUG#38077 ####
let $tables= query_get_value(SHOW TABLES, Tables_in_test, 1);
if (`SELECT '$tables' != 't1'`)
{
--echo **** TEST CASE BUG! PRINTING DEBUG INFO! ****
--echo **** Dear developer, if you see this in the output of a test
--echo **** case run, please add all the information below as a
--echo **** comment to BUG#38077. If it's a pushbuild failure, please
--echo **** include a link to the push page.
--echo **** Thank you! /Sven
SHOW BINLOG EVENTS;
--echo **** master binlog ****
--error 0,1
--exec $MYSQL_BINLOG --hexdump $MYSQLTEST_VARDIR/log/master-bin.000001
--echo **** slave binlog ****
--error 0,1
--exec $MYSQL_BINLOG --hexdump $MYSQLTEST_VARDIR/log/slave-bin.000001
--echo **** slave status ****
query_vertical SHOW SLAVE STATUS;
--echo **** slave's master status ****
SHOW MASTER STATUS;
--echo **** slave binlog events ****
--echo [on master]
connection master;
--echo **** master status ****
SHOW MASTER STATUS;
--echo **** master binlog events ****
SHOW BINLOG EVENTS;
exit;
}
#### END DEBUG INFO ####
SELECT * FROM t1; SELECT * FROM t1;
--replace_result $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYPORT MASTER_PORT

View File

@ -244,7 +244,7 @@ connection master;
# We should be gold by the time, so I will get rid of our file. # We should be gold by the time, so I will get rid of our file.
--exec rm $MYSQLTEST_VARDIR/tmp/remote.sql --remove_file $MYSQLTEST_VARDIR/tmp/remote.sql
################### End Bug 17654 ###################### ################### End Bug 17654 ######################
# What is the point of this test? It seems entirely pointless. It # What is the point of this test? It seems entirely pointless. It
@ -349,9 +349,9 @@ FLUSH LOGS;
--diff_files $MYSQLTEST_VARDIR/tmp/local.sql $MYSQLTEST_VARDIR/tmp/remote.sql --diff_files $MYSQLTEST_VARDIR/tmp/local.sql $MYSQLTEST_VARDIR/tmp/remote.sql
--exec rm $MYSQLTEST_VARDIR/tmp/remote.sql --remove_file $MYSQLTEST_VARDIR/tmp/remote.sql
--exec rm $MYSQLTEST_VARDIR/tmp/local.sql --remove_file $MYSQLTEST_VARDIR/tmp/local.sql
DROP TABLE IF EXISTS t1, t2, t3, t04, t05, t4, t5; DROP TABLE IF EXISTS t1, t2, t3, t04, t05, t4, t5;
sync_slave_with_master; sync_slave_with_master;

View File

@ -34,4 +34,10 @@ delimiter ;|
--error 1220 --error 1220
SHOW BINLOG EVENTS FROM 364; SHOW BINLOG EVENTS FROM 364;
--echo Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment.
CREATE TABLE t1 (a varchar(16)) character set cp932;
INSERT INTO t1 VALUES (0x8372835E),(0x8352835E);
SELECT hex(a), hex(lower(a)), hex(upper(a)) FROM t1 ORDER BY binary(a);
DROP TABLE t1;
--echo End of 5.1 tests --echo End of 5.1 tests

View File

@ -83,3 +83,13 @@ SET NAMES sjis;
SELECT HEX('佐淘 圭') FROM DUAL; SELECT HEX('佐淘 圭') FROM DUAL;
# End of 4.1 tests # End of 4.1 tests
--echo # Start of 5.1 tests
--echo Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment.
CREATE TABLE t1 (a varchar(16)) character set sjis;
INSERT INTO t1 VALUES (0x8372835E),(0x8352835E);
SELECT hex(a), hex(lower(a)), hex(upper(a)) FROM t1 ORDER BY binary(a);
DROP TABLE t1;
--echo # End of 5.1 tests

View File

@ -462,3 +462,12 @@ CREATE TABLE t1(a TEXT);
--error ER_WRONG_ARGUMENTS --error ER_WRONG_ARGUMENTS
SELECT GROUP_CONCAT(a) AS st FROM t1 HAVING MATCH(st) AGAINST('test' IN BOOLEAN MODE); SELECT GROUP_CONCAT(a) AS st FROM t1 HAVING MATCH(st) AGAINST('test' IN BOOLEAN MODE);
DROP TABLE t1; DROP TABLE t1;
#
# BUG#42907 - Multi-term boolean fulltext query containing a single
# quote fails in 5.1.x
#
CREATE TABLE t1(a VARCHAR(64), FULLTEXT(a));
INSERT INTO t1 VALUES('awrd bwrd cwrd'),('awrd bwrd cwrd'),('awrd bwrd cwrd');
SELECT * FROM t1 WHERE MATCH(a) AGAINST('+awrd bwrd* +cwrd*' IN BOOLEAN MODE);
DROP TABLE t1;

View File

@ -41,7 +41,7 @@ while ($1)
let $2=10; let $2=10;
while ($2) while ($2)
{ {
eval INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point($1 * 10 - 9, $2 * 10 - 9), Point($1 * 10, $2 * 10)))); eval INSERT INTO t2 (g) VALUES (LineString(Point($1 * 10 - 9, $2 * 10 - 9), Point($1 * 10, $2 * 10)));
dec $2; dec $2;
} }
dec $1; dec $1;
@ -61,7 +61,7 @@ while ($1)
let $2=10; let $2=10;
while ($2) while ($2)
{ {
eval DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point($1 * 10 - 9, $2 * 10 - 9), Point($1 * 10, $2 * 10))))); eval DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point($1 * 10 - 9, $2 * 10 - 9), Point($1 * 10, $2 * 10))));
SELECT count(*) FROM t2; SELECT count(*) FROM t2;
dec $2; dec $2;
} }
@ -235,11 +235,11 @@ DROP TABLE t1;
# Bug #21888: Query on GEOMETRY field using PointFromWKB() results in lost connection # Bug #21888: Query on GEOMETRY field using PointFromWKB() results in lost connection
# #
CREATE TABLE t1 (foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) ); CREATE TABLE t1 (foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) );
INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(1,1))); INSERT INTO t1 (foo) VALUES (POINT(1,1));
INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(1,0))); INSERT INTO t1 (foo) VALUES (POINT(1,0));
INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(0,1))); INSERT INTO t1 (foo) VALUES (POINT(0,1));
INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(0,0))); INSERT INTO t1 (foo) VALUES (POINT(0,0));
SELECT 1 FROM t1 WHERE foo != PointFromWKB(POINT(0,0)); SELECT 1 FROM t1 WHERE foo != POINT(0,0);
DROP TABLE t1; DROP TABLE t1;
# #
@ -802,35 +802,35 @@ DROP TABLE t1;
# #
create table t1 (a geometry not null, spatial index(a)); create table t1 (a geometry not null, spatial index(a));
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 131072))); insert into t1 values (POINT(1.1517219314031e+164, 131072));
insert into t1 values (PointFromWKB(POINT(9.1248812352444e+192, 2.9740338169556e+284))); insert into t1 values (POINT(9.1248812352444e+192, 2.9740338169556e+284));
insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, -0))); insert into t1 values (POINT(4.7783097267365e-299, -0));
insert into t1 values (PointFromWKB(POINT(1.49166814624e-154, 2.0880974297595e-53))); insert into t1 values (POINT(1.49166814624e-154, 2.0880974297595e-53));
insert into t1 values (PointFromWKB(POINT(4.0917382598702e+149, 1.2024538023802e+111))); insert into t1 values (POINT(4.0917382598702e+149, 1.2024538023802e+111));
insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 2.9993936277913e-241))); insert into t1 values (POINT(2.0349165139404e+236, 2.9993936277913e-241));
insert into t1 values (PointFromWKB(POINT(2.5243548967072e-29, 1.2024538023802e+111))); insert into t1 values (POINT(2.5243548967072e-29, 1.2024538023802e+111));
insert into t1 values (PointFromWKB(POINT(0, 6.9835074892995e-251))); insert into t1 values (POINT(0, 6.9835074892995e-251));
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 3.1050361846014e+231))); insert into t1 values (POINT(2.0880974297595e-53, 3.1050361846014e+231));
insert into t1 values (PointFromWKB(POINT(2.8728483499323e-188, 2.4600631144627e+260))); insert into t1 values (POINT(2.8728483499323e-188, 2.4600631144627e+260));
insert into t1 values (PointFromWKB(POINT(3.0517578125e-05, 2.0349165139404e+236))); insert into t1 values (POINT(3.0517578125e-05, 2.0349165139404e+236));
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 1.1818212630766e-125))); insert into t1 values (POINT(1.1517219314031e+164, 1.1818212630766e-125));
insert into t1 values (PointFromWKB(POINT(2.481040258324e-265, 5.7766220027675e-275))); insert into t1 values (POINT(2.481040258324e-265, 5.7766220027675e-275));
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 2.5243548967072e-29))); insert into t1 values (POINT(2.0880974297595e-53, 2.5243548967072e-29));
insert into t1 values (PointFromWKB(POINT(5.7766220027675e-275, 9.9464647281957e+86))); insert into t1 values (POINT(5.7766220027675e-275, 9.9464647281957e+86));
insert into t1 values (PointFromWKB(POINT(2.2181357552967e+130, 3.7857669957337e-270))); insert into t1 values (POINT(2.2181357552967e+130, 3.7857669957337e-270));
insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.6893488147419e+19))); insert into t1 values (POINT(4.5767114681874e-246, 3.6893488147419e+19));
insert into t1 values (PointFromWKB(POINT(4.5767114681874e-246, 3.7537584144024e+255))); insert into t1 values (POINT(4.5767114681874e-246, 3.7537584144024e+255));
insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 1.8033161362863e-130))); insert into t1 values (POINT(3.7857669957337e-270, 1.8033161362863e-130));
insert into t1 values (PointFromWKB(POINT(0, 5.8774717541114e-39))); insert into t1 values (POINT(0, 5.8774717541114e-39));
insert into t1 values (PointFromWKB(POINT(1.1517219314031e+164, 2.2761049594727e-159))); insert into t1 values (POINT(1.1517219314031e+164, 2.2761049594727e-159));
insert into t1 values (PointFromWKB(POINT(6.243497100632e+144, 3.7857669957337e-270))); insert into t1 values (POINT(6.243497100632e+144, 3.7857669957337e-270));
insert into t1 values (PointFromWKB(POINT(3.7857669957337e-270, 2.6355494858076e-82))); insert into t1 values (POINT(3.7857669957337e-270, 2.6355494858076e-82));
insert into t1 values (PointFromWKB(POINT(2.0349165139404e+236, 3.8518598887745e-34))); insert into t1 values (POINT(2.0349165139404e+236, 3.8518598887745e-34));
insert into t1 values (PointFromWKB(POINT(4.6566128730774e-10, 2.0880974297595e-53))); insert into t1 values (POINT(4.6566128730774e-10, 2.0880974297595e-53));
insert into t1 values (PointFromWKB(POINT(2.0880974297595e-53, 1.8827498946116e-183))); insert into t1 values (POINT(2.0880974297595e-53, 1.8827498946116e-183));
insert into t1 values (PointFromWKB(POINT(1.8033161362863e-130, 9.1248812352444e+192))); insert into t1 values (POINT(1.8033161362863e-130, 9.1248812352444e+192));
insert into t1 values (PointFromWKB(POINT(4.7783097267365e-299, 2.2761049594727e-159))); insert into t1 values (POINT(4.7783097267365e-299, 2.2761049594727e-159));
insert into t1 values (PointFromWKB(POINT(1.94906280228e+289, 1.2338789709327e-178))); insert into t1 values (POINT(1.94906280228e+289, 1.2338789709327e-178));
drop table t1; drop table t1;
# End of 4.1 tests # End of 4.1 tests

View File

@ -37,32 +37,32 @@ INSERT INTO gis_point VALUES
INSERT INTO gis_line VALUES INSERT INTO gis_line VALUES
(105, LineFromText('LINESTRING(0 0,0 10,10 0)')), (105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')), (106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
(107, LineStringFromWKB(LineString(Point(10, 10), Point(40, 10)))); (107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));
INSERT INTO gis_polygon VALUES INSERT INTO gis_polygon VALUES
(108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')), (108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
(109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')), (109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
(110, PolyFromWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))); (110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))));
INSERT INTO gis_multi_point VALUES INSERT INTO gis_multi_point VALUES
(111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')), (111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
(112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')), (112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
(113, MPointFromWKB(MultiPoint(Point(3, 6), Point(4, 10)))); (113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));
INSERT INTO gis_multi_line VALUES INSERT INTO gis_multi_line VALUES
(114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')), (114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
(115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')), (115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
(116, MLineFromWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))); (116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))));
INSERT INTO gis_multi_polygon VALUES INSERT INTO gis_multi_polygon VALUES
(117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), (117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
(118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')), (118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
(119, MPolyFromWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))); (119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
INSERT INTO gis_geometrycollection VALUES INSERT INTO gis_geometrycollection VALUES
(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')), (120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
(121, GeometryFromWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9))))); (121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9))))));
INSERT into gis_geometry SELECT * FROM gis_point; INSERT into gis_geometry SELECT * FROM gis_point;
INSERT into gis_geometry SELECT * FROM gis_line; INSERT into gis_geometry SELECT * FROM gis_line;

View File

@ -323,6 +323,16 @@ INSERT INTO t2 (f1, f2)
SELECT * FROM t2; SELECT * FROM t2;
DROP TABLE t1, t2; DROP TABLE t1, t2;
#
# Bug#44306: Assertion fail on duplicate key error in 'INSERT ... SELECT'
# statements
#
CREATE TABLE t1 ( a INT KEY, b INT );
INSERT INTO t1 VALUES ( 0, 1 );
--error ER_DUP_ENTRY
INSERT INTO t1 ( b ) SELECT MAX( b ) FROM t1 WHERE b = 2;
DROP TABLE t1;
# #
# Bug #26207: inserts don't work with shortened index # Bug #26207: inserts don't work with shortened index
# #

View File

@ -1478,5 +1478,30 @@ let $MYSQLD_DATADIR= `select @@datadir`;
--exec $MYISAMCHK -d $MYSQLD_DATADIR/test/t1 --exec $MYISAMCHK -d $MYSQLD_DATADIR/test/t1
DROP TABLE t1; DROP TABLE t1;
#
# Bug#43737: Select query return bad result
#
CREATE TABLE t1 (
c INT,
d bit(1),
e INT,
f VARCHAR(1),
g BIT(1),
h BIT(1),
KEY (h, d, e, g)
);
INSERT INTO t1 VALUES
( 3, 1, 1, 'a', 0, 0 ),
( 3, 1, 5, 'a', 0, 0 ),
( 10, 1, 2, 'a', 0, 1 ),
( 10, 1, 3, 'a', 0, 1 ),
( 10, 1, 4, 'a', 0, 1 );
SELECT f FROM t1 WHERE d = 1 AND e = 2 AND g = 0 AND h = 1;
SELECT h+0, d + 0, e, g + 0 FROM t1;
DROP TABLE t1;
--echo End of 5.1 tests --echo End of 5.1 tests

View File

@ -0,0 +1,54 @@
--source include/have_debug.inc
--echo #
--echo # BUG#40827 - Killing insert-select to MyISAM can cause table corruption
--echo #
CONNECT (insertConn, localhost, root,,);
CREATE TABLE `t1` (
`id` BIGINT(20) ,
`id1` BIGINT(20) AUTO_INCREMENT,
KEY(id1), KEY(id)
) ENGINE=MyISAM;
CREATE TABLE `t2` (
`id` BIGINT(20) ,
`id1` BIGINT(20) AUTO_INCREMENT,
KEY (id1), KEY(id)
) ENGINE=MyISAM;
INSERT INTO t2 (id) VALUES (123);
let $i = 10;
while ($i)
{
INSERT INTO t2 (id) SELECT id FROM t2;
dec $i;
}
--echo # Switch to insert Connection
CONNECTION insertConn;
SET SESSION debug='+d,wait_in_enable_indexes';
--echo # Send insert data
SEND INSERT INTO t1(id) SELECT id FROM t2;
--echo # Switch to default Connection
CONNECTION default;
--echo # Wait for insert data to reach the debug point
let $wait_condition=
SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE STATE = "wait_in_enable_indexes" AND
INFO = "INSERT INTO t1(id) SELECT id FROM t2";
--source include/wait_condition.inc
SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE STATE = 'wait_in_enable_indexes' AND
INFO = "INSERT INTO t1(id) SELECT id FROM t2"
INTO @thread_id;
KILL QUERY @thread_id;
CHECK TABLE t1;
DROP TABLE t1,t2;
DISCONNECT insertConn;

View File

@ -8270,6 +8270,33 @@ select replace(@full_mode, 'ALLOW_INVALID_DATES', 'INVALID_DATES') into @full_mo
select name from mysql.proc where name = 'p' and sql_mode = @full_mode; select name from mysql.proc where name = 'p' and sql_mode = @full_mode;
drop procedure p; drop procedure p;
#
# Bug#43962 "Packets out of order" calling a SHOW TABLE STATUS
#
DELIMITER //;
CREATE DEFINER = 'root'@'localhost' PROCEDURE p1()
NOT DETERMINISTIC
CONTAINS SQL
SQL SECURITY DEFINER
COMMENT ''
BEGIN
SHOW TABLE STATUS like 't1';
END;//
DELIMITER ;//
CREATE TABLE t1 (f1 INT);
--disable_result_log
let $tab_count= 4;
while ($tab_count)
{
EVAL CALL p1();
dec $tab_count ;
}
--enable_result_log
DROP PROCEDURE p1;
DROP TABLE t1;
--echo # ------------------------------------------------------------------ --echo # ------------------------------------------------------------------
--echo # -- End of 5.1 tests --echo # -- End of 5.1 tests
--echo # ------------------------------------------------------------------ --echo # ------------------------------------------------------------------

View File

@ -8,17 +8,17 @@
delimiter |; delimiter |;
# #
# Bug #13270 INSERT,UPDATE,etc that calls func with side-effect does not binlog # Bug#13270 INSERT,UPDATE,etc that calls func with side-effect does not binlog
# Bug #23333 stored function + non-transac table + transac table = # Bug#23333 stored function + non-transac table + transac table =
# breaks stmt-based binlog # breaks stmt-based binlog
# Bug #27395 OPTION_STATUS_NO_TRANS_UPDATE is not preserved at the end of SF() # Bug#27395 OPTION_STATUS_NO_TRANS_UPDATE is not preserved at the end of SF()
# #
--disable_warnings --disable_warnings
drop function if exists bug23333| drop function if exists bug23333|
drop table if exists t1,t2| drop table if exists t1,t2|
--enable_warnings --enable_warnings
CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM| CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM|
CREATE TABLE t2 (a int NOT NULL auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB| CREATE TABLE t2 (a int NOT NULL auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB|
insert into t2 values (1,1)| insert into t2 values (1,1)|

View File

@ -669,6 +669,25 @@ SELECT ROW(1,2) = (SELECT NULL, 1), ROW(1,2) IN (SELECT NULL, 1);
SELECT ROW(1,2) = (SELECT 1, 1), ROW(1,2) IN (SELECT 1, 1); SELECT ROW(1,2) = (SELECT 1, 1), ROW(1,2) IN (SELECT 1, 1);
SELECT ROW(1,2) = (SELECT 1, 2), ROW(1,2) IN (SELECT 1, 2); SELECT ROW(1,2) = (SELECT 1, 2), ROW(1,2) IN (SELECT 1, 2);
#
# Bug #37362 Crash in do_field_eq
#
CREATE TABLE t1 (a INT, b INT, c INT);
INSERT INTO t1 VALUES (1,1,1), (1,1,1);
--error 1054
EXPLAIN EXTENDED
SELECT c FROM
( SELECT
(SELECT COUNT(a) FROM
(SELECT COUNT(b) FROM t1) AS x GROUP BY c
) FROM t1 GROUP BY b
) AS y;
SHOW WARNINGS;
DROP TABLE t1;
--echo End of 5.0 tests --echo End of 5.0 tests
# #

View File

@ -48,6 +48,20 @@ select * from `txu#p#p1`;
drop table `txu@0023p@0023p1`; drop table `txu@0023p@0023p1`;
drop table `txu#p#p1`; drop table `txu#p#p1`;
--echo #
--echo # Bug#37631 Incorrect key file for table after upgrading from 5.0 to 5.1
--echo #
--echo # copy table created using mysql4.0 into the data dir
let $MYSQLD_DATADIR= `SELECT @@datadir`;
copy_file std_data/bug37631.frm $MYSQLD_DATADIR/test/t1.frm;
copy_file std_data/bug37631.MYD $MYSQLD_DATADIR/test/t1.MYD;
copy_file std_data/bug37631.MYI $MYSQLD_DATADIR/test/t1.MYI;
--echo # check the table created using mysql 4.0
CHECK TABLE t1;
--echo # query the table created using mysql 4.0
SELECT * FROM t1;
DROP TABLE t1;
# #
# Check if old tables work # Check if old tables work
# #

View File

@ -2044,13 +2044,15 @@ restart:
} }
else else
{ {
size_t block_mem_offset;
/* There are some never used blocks, take first of them */ /* There are some never used blocks, take first of them */
DBUG_ASSERT(keycache->blocks_used < DBUG_ASSERT(keycache->blocks_used <
(ulong) keycache->disk_blocks); (ulong) keycache->disk_blocks);
block= &keycache->block_root[keycache->blocks_used]; block= &keycache->block_root[keycache->blocks_used];
block_mem_offset=
((size_t) keycache->blocks_used) * keycache->key_cache_block_size;
block->buffer= ADD_TO_PTR(keycache->block_mem, block->buffer= ADD_TO_PTR(keycache->block_mem,
((ulong) keycache->blocks_used* block_mem_offset,
keycache->key_cache_block_size),
uchar*); uchar*);
keycache->blocks_used++; keycache->blocks_used++;
DBUG_ASSERT(!block->next_used); DBUG_ASSERT(!block->next_used);

View File

@ -174,7 +174,7 @@ void *_mymalloc(size_t size, const char *filename, uint lineno, myf MyFlags)
data[size + 3]= MAGICEND3; data[size + 3]= MAGICEND3;
irem->filename= (char *) filename; irem->filename= (char *) filename;
irem->linenum= lineno; irem->linenum= lineno;
irem->datasize= (uint32) size; irem->datasize= size;
irem->prev= NULL; irem->prev= NULL;
/* Add this remember structure to the linked list */ /* Add this remember structure to the linked list */

View File

@ -876,9 +876,9 @@ typedef struct {
ulonglong delete_length; ulonglong delete_length;
ha_rows records; ha_rows records;
ulong mean_rec_length; ulong mean_rec_length;
time_t create_time; ulong create_time;
time_t check_time; ulong check_time;
time_t update_time; ulong update_time;
ulonglong check_sum; ulonglong check_sum;
} PARTITION_INFO; } PARTITION_INFO;
@ -1037,9 +1037,9 @@ public:
ha_rows records; ha_rows records;
ha_rows deleted; /* Deleted records */ ha_rows deleted; /* Deleted records */
ulong mean_rec_length; /* physical reclength */ ulong mean_rec_length; /* physical reclength */
time_t create_time; /* When table was created */ ulong create_time; /* When table was created */
time_t check_time; ulong check_time;
time_t update_time; ulong update_time;
uint block_size; /* index block size */ uint block_size; /* index block size */
ha_statistics(): ha_statistics():

View File

@ -3390,14 +3390,12 @@ static void mark_as_dependent(THD *thd, SELECT_LEX *last, SELECT_LEX *current,
current->mark_as_dependent(last); current->mark_as_dependent(last);
if (thd->lex->describe & DESCRIBE_EXTENDED) if (thd->lex->describe & DESCRIBE_EXTENDED)
{ {
char warn_buff[MYSQL_ERRMSG_SIZE]; push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
sprintf(warn_buff, ER(ER_WARN_FIELD_RESOLVED), ER_WARN_FIELD_RESOLVED, ER(ER_WARN_FIELD_RESOLVED),
db_name, (db_name[0] ? "." : ""), db_name, (db_name[0] ? "." : ""),
table_name, (table_name [0] ? "." : ""), table_name, (table_name [0] ? "." : ""),
resolved_item->field_name, resolved_item->field_name,
current->select_number, last->select_number); current->select_number, last->select_number);
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_WARN_FIELD_RESOLVED, warn_buff);
} }
} }

View File

@ -78,10 +78,17 @@ String *Item_func_geometry_from_wkb::val_str(String *str)
{ {
DBUG_ASSERT(fixed == 1); DBUG_ASSERT(fixed == 1);
String arg_val; String arg_val;
String *wkb= args[0]->val_str(&arg_val); String *wkb;
Geometry_buffer buffer; Geometry_buffer buffer;
uint32 srid= 0; uint32 srid= 0;
if (args[0]->field_type() == MYSQL_TYPE_GEOMETRY)
{
return args[0]->val_str(str);
}
wkb= args[0]->val_str(&arg_val);
if ((arg_count == 2) && !args[1]->null_value) if ((arg_count == 2) && !args[1]->null_value)
srid= (uint32)args[1]->val_int(); srid= (uint32)args[1]->val_int();
@ -345,14 +352,16 @@ String *Item_func_point::val_str(String *str)
DBUG_ASSERT(fixed == 1); DBUG_ASSERT(fixed == 1);
double x= args[0]->val_real(); double x= args[0]->val_real();
double y= args[1]->val_real(); double y= args[1]->val_real();
uint32 srid= 0;
if ((null_value= (args[0]->null_value || if ((null_value= (args[0]->null_value ||
args[1]->null_value || args[1]->null_value ||
str->realloc(1 + 4 + SIZEOF_STORED_DOUBLE*2)))) str->realloc(4/*SRID*/ + 1 + 4 + SIZEOF_STORED_DOUBLE*2))))
return 0; return 0;
str->set_charset(&my_charset_bin); str->set_charset(&my_charset_bin);
str->length(0); str->length(0);
str->q_append(srid);
str->q_append((char)Geometry::wkb_ndr); str->q_append((char)Geometry::wkb_ndr);
str->q_append((uint32)Geometry::wkb_point); str->q_append((uint32)Geometry::wkb_point);
str->q_append(x); str->q_append(x);
@ -376,12 +385,14 @@ String *Item_func_spatial_collection::val_str(String *str)
DBUG_ASSERT(fixed == 1); DBUG_ASSERT(fixed == 1);
String arg_value; String arg_value;
uint i; uint i;
uint32 srid= 0;
str->set_charset(&my_charset_bin); str->set_charset(&my_charset_bin);
str->length(0); str->length(0);
if (str->reserve(1 + 4 + 4, 512)) if (str->reserve(4/*SRID*/ + 1 + 4 + 4, 512))
goto err; goto err;
str->q_append(srid);
str->q_append((char) Geometry::wkb_ndr); str->q_append((char) Geometry::wkb_ndr);
str->q_append((uint32) coll_type); str->q_append((uint32) coll_type);
str->q_append((uint32) arg_count); str->q_append((uint32) arg_count);
@ -399,13 +410,13 @@ String *Item_func_spatial_collection::val_str(String *str)
In the case of GeometryCollection we don't need any checkings In the case of GeometryCollection we don't need any checkings
for item types, so just copy them into target collection for item types, so just copy them into target collection
*/ */
if (str->append(res->ptr(), len, (uint32) 512)) if (str->append(res->ptr() + 4/*SRID*/, len - 4/*SRID*/, (uint32) 512))
goto err; goto err;
} }
else else
{ {
enum Geometry::wkbType wkb_type; enum Geometry::wkbType wkb_type;
const char *data= res->ptr() + 1; const char *data= res->ptr() + 4/*SRID*/ + 1;
/* /*
In the case of named collection we must check that items In the case of named collection we must check that items
@ -414,7 +425,7 @@ String *Item_func_spatial_collection::val_str(String *str)
wkb_type= (Geometry::wkbType) uint4korr(data); wkb_type= (Geometry::wkbType) uint4korr(data);
data+= 4; data+= 4;
len-= 5; len-= 5 + 4/*SRID*/;
if (wkb_type != item_type) if (wkb_type != item_type)
goto err; goto err;

View File

@ -340,8 +340,7 @@ Rpl_filter::add_wild_table_rule(DYNAMIC_ARRAY* a, const char* table_spec)
e->tbl_name= e->db + (dot - table_spec) + 1; e->tbl_name= e->db + (dot - table_spec) + 1;
e->key_len= len; e->key_len= len;
memcpy(e->db, table_spec, len); memcpy(e->db, table_spec, len);
insert_dynamic(a, (uchar*)&e); return insert_dynamic(a, (uchar*)&e);
return 0;
} }

View File

@ -143,8 +143,8 @@ static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi);
static Log_event* next_event(Relay_log_info* rli); static Log_event* next_event(Relay_log_info* rli);
static int queue_event(Master_info* mi,const char* buf,ulong event_len); static int queue_event(Master_info* mi,const char* buf,ulong event_len);
static int terminate_slave_thread(THD *thd, static int terminate_slave_thread(THD *thd,
pthread_mutex_t* term_lock, pthread_mutex_t *term_lock,
pthread_cond_t* term_cond, pthread_cond_t *term_cond,
volatile uint *slave_running, volatile uint *slave_running,
bool skip_lock); bool skip_lock);
static bool check_io_slave_killed(THD *thd, Master_info *mi, const char *info); static bool check_io_slave_killed(THD *thd, Master_info *mi, const char *info);
@ -399,22 +399,22 @@ int terminate_slave_threads(Master_info* mi,int thread_mask,bool skip_lock)
int error,force_all = (thread_mask & SLAVE_FORCE_ALL); int error,force_all = (thread_mask & SLAVE_FORCE_ALL);
pthread_mutex_t *sql_lock = &mi->rli.run_lock, *io_lock = &mi->run_lock; pthread_mutex_t *sql_lock = &mi->rli.run_lock, *io_lock = &mi->run_lock;
if ((thread_mask & (SLAVE_IO|SLAVE_FORCE_ALL))) if (thread_mask & (SLAVE_IO|SLAVE_FORCE_ALL))
{ {
DBUG_PRINT("info",("Terminating IO thread")); DBUG_PRINT("info",("Terminating IO thread"));
mi->abort_slave=1; mi->abort_slave=1;
if ((error=terminate_slave_thread(mi->io_thd,io_lock, if ((error=terminate_slave_thread(mi->io_thd, io_lock,
&mi->stop_cond, &mi->stop_cond,
&mi->slave_running, &mi->slave_running,
skip_lock)) && skip_lock)) &&
!force_all) !force_all)
DBUG_RETURN(error); DBUG_RETURN(error);
} }
if ((thread_mask & (SLAVE_SQL|SLAVE_FORCE_ALL))) if (thread_mask & (SLAVE_SQL|SLAVE_FORCE_ALL))
{ {
DBUG_PRINT("info",("Terminating SQL thread")); DBUG_PRINT("info",("Terminating SQL thread"));
mi->rli.abort_slave=1; mi->rli.abort_slave=1;
if ((error=terminate_slave_thread(mi->rli.sql_thd,sql_lock, if ((error=terminate_slave_thread(mi->rli.sql_thd, sql_lock,
&mi->rli.stop_cond, &mi->rli.stop_cond,
&mi->rli.slave_running, &mi->rli.slave_running,
skip_lock)) && skip_lock)) &&
@ -424,7 +424,6 @@ int terminate_slave_threads(Master_info* mi,int thread_mask,bool skip_lock)
DBUG_RETURN(0); DBUG_RETURN(0);
} }
/** /**
Wait for a slave thread to terminate. Wait for a slave thread to terminate.
@ -452,30 +451,45 @@ int terminate_slave_threads(Master_info* mi,int thread_mask,bool skip_lock)
the condition. In this case, it is assumed that the calling the condition. In this case, it is assumed that the calling
function acquires the lock before calling this function. function acquires the lock before calling this function.
@retval 0 All OK @retval 0 All OK ER_SLAVE_NOT_RUNNING otherwise.
@note If the executing thread has to acquire term_lock (skip_lock
is false), the negative running status does not represent
any issue therefore no error is reported.
*/ */
static int static int
terminate_slave_thread(THD *thd, terminate_slave_thread(THD *thd,
pthread_mutex_t* term_lock, pthread_mutex_t *term_lock,
pthread_cond_t* term_cond, pthread_cond_t *term_cond,
volatile uint *slave_running, volatile uint *slave_running,
bool skip_lock) bool skip_lock)
{ {
int error;
DBUG_ENTER("terminate_slave_thread"); DBUG_ENTER("terminate_slave_thread");
if (!skip_lock) if (!skip_lock)
{
pthread_mutex_lock(term_lock); pthread_mutex_lock(term_lock);
}
else
{
safe_mutex_assert_owner(term_lock); safe_mutex_assert_owner(term_lock);
}
if (!*slave_running) if (!*slave_running)
{ {
if (!skip_lock) if (!skip_lock)
{
/*
if run_lock (term_lock) is acquired locally then either
slave_running status is fine
*/
pthread_mutex_unlock(term_lock); pthread_mutex_unlock(term_lock);
DBUG_RETURN(0);
}
else
{
DBUG_RETURN(ER_SLAVE_NOT_RUNNING); DBUG_RETURN(ER_SLAVE_NOT_RUNNING);
} }
}
DBUG_ASSERT(thd != 0); DBUG_ASSERT(thd != 0);
THD_CHECK_SENTRY(thd); THD_CHECK_SENTRY(thd);
@ -486,6 +500,7 @@ terminate_slave_thread(THD *thd,
while (*slave_running) // Should always be true while (*slave_running) // Should always be true
{ {
int error;
DBUG_PRINT("loop", ("killing slave thread")); DBUG_PRINT("loop", ("killing slave thread"));
pthread_mutex_lock(&thd->LOCK_delete); pthread_mutex_lock(&thd->LOCK_delete);
@ -627,7 +642,7 @@ int start_slave_threads(bool need_slave_mutex, bool wait_for_start,
&mi->rli.slave_running, &mi->rli.slave_run_id, &mi->rli.slave_running, &mi->rli.slave_run_id,
mi, 0); mi, 0);
if (error) if (error)
terminate_slave_threads(mi, thread_mask & SLAVE_IO, 0); terminate_slave_threads(mi, thread_mask & SLAVE_IO, !need_slave_mutex);
} }
DBUG_RETURN(error); DBUG_RETURN(error);
} }
@ -2640,6 +2655,7 @@ err:
delete the mi structure leading to a crash! (see BUG#25306 for details) delete the mi structure leading to a crash! (see BUG#25306 for details)
*/ */
pthread_cond_broadcast(&mi->stop_cond); // tell the world we are done pthread_cond_broadcast(&mi->stop_cond); // tell the world we are done
DBUG_EXECUTE_IF("simulate_slave_delay_at_terminate_bug38694", sleep(5););
pthread_mutex_unlock(&mi->run_lock); pthread_mutex_unlock(&mi->run_lock);
my_thread_end(); my_thread_end();
pthread_exit(0); pthread_exit(0);
@ -2989,6 +3005,7 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \
delete the mi structure leading to a crash! (see BUG#25306 for details) delete the mi structure leading to a crash! (see BUG#25306 for details)
*/ */
pthread_cond_broadcast(&rli->stop_cond); pthread_cond_broadcast(&rli->stop_cond);
DBUG_EXECUTE_IF("simulate_slave_delay_at_terminate_bug38694", sleep(5););
pthread_mutex_unlock(&rli->run_lock); // tell the world we are done pthread_mutex_unlock(&rli->run_lock); // tell the world we are done
my_thread_end(); my_thread_end();

View File

@ -207,6 +207,7 @@ sp_get_flags_for_command(LEX *lex)
case SQLCOM_SHOW_STATUS_PROC: case SQLCOM_SHOW_STATUS_PROC:
case SQLCOM_SHOW_STORAGE_ENGINES: case SQLCOM_SHOW_STORAGE_ENGINES:
case SQLCOM_SHOW_TABLES: case SQLCOM_SHOW_TABLES:
case SQLCOM_SHOW_TABLE_STATUS:
case SQLCOM_SHOW_VARIABLES: case SQLCOM_SHOW_VARIABLES:
case SQLCOM_SHOW_WARNS: case SQLCOM_SHOW_WARNS:
case SQLCOM_REPAIR: case SQLCOM_REPAIR:
@ -2132,17 +2133,16 @@ sp_head::restore_lex(THD *thd)
/** /**
Put the instruction on the backpatch list, associated with the label. Put the instruction on the backpatch list, associated with the label.
*/ */
void int
sp_head::push_backpatch(sp_instr *i, sp_label_t *lab) sp_head::push_backpatch(sp_instr *i, sp_label_t *lab)
{ {
bp_t *bp= (bp_t *)sql_alloc(sizeof(bp_t)); bp_t *bp= (bp_t *)sql_alloc(sizeof(bp_t));
if (bp) if (!bp)
{ return 1;
bp->lab= lab; bp->lab= lab;
bp->instr= i; bp->instr= i;
(void)m_backpatch.push_front(bp); return m_backpatch.push_front(bp);
}
} }
/** /**
@ -2217,7 +2217,7 @@ sp_head::fill_field_definition(THD *thd, LEX *lex,
} }
void int
sp_head::new_cont_backpatch(sp_instr_opt_meta *i) sp_head::new_cont_backpatch(sp_instr_opt_meta *i)
{ {
m_cont_level+= 1; m_cont_level+= 1;
@ -2225,15 +2225,17 @@ sp_head::new_cont_backpatch(sp_instr_opt_meta *i)
{ {
/* Use the cont. destination slot to store the level */ /* Use the cont. destination slot to store the level */
i->m_cont_dest= m_cont_level; i->m_cont_dest= m_cont_level;
(void)m_cont_backpatch.push_front(i); if (m_cont_backpatch.push_front(i))
return 1;
} }
return 0;
} }
void int
sp_head::add_cont_backpatch(sp_instr_opt_meta *i) sp_head::add_cont_backpatch(sp_instr_opt_meta *i)
{ {
i->m_cont_dest= m_cont_level; i->m_cont_dest= m_cont_level;
(void)m_cont_backpatch.push_front(i); return m_cont_backpatch.push_front(i);
} }
void void
@ -2469,7 +2471,7 @@ sp_head::show_create_routine(THD *thd, int type)
@param instr Instruction @param instr Instruction
*/ */
void sp_head::add_instr(sp_instr *instr) int sp_head::add_instr(sp_instr *instr)
{ {
instr->free_list= m_thd->free_list; instr->free_list= m_thd->free_list;
m_thd->free_list= 0; m_thd->free_list= 0;
@ -2480,7 +2482,7 @@ void sp_head::add_instr(sp_instr *instr)
entire stored procedure, as their life span is equal. entire stored procedure, as their life span is equal.
*/ */
instr->mem_root= &main_mem_root; instr->mem_root= &main_mem_root;
insert_dynamic(&m_instr, (uchar*)&instr); return insert_dynamic(&m_instr, (uchar*)&instr);
} }

View File

@ -308,7 +308,7 @@ public:
bool bool
show_create_routine(THD *thd, int type); show_create_routine(THD *thd, int type);
void int
add_instr(sp_instr *instr); add_instr(sp_instr *instr);
inline uint inline uint
@ -344,7 +344,7 @@ public:
restore_lex(THD *thd); restore_lex(THD *thd);
/// Put the instruction on the backpatch list, associated with the label. /// Put the instruction on the backpatch list, associated with the label.
void int
push_backpatch(sp_instr *, struct sp_label *); push_backpatch(sp_instr *, struct sp_label *);
/// Update all instruction with this label in the backpatch list to /// Update all instruction with this label in the backpatch list to
@ -353,11 +353,11 @@ public:
backpatch(struct sp_label *); backpatch(struct sp_label *);
/// Start a new cont. backpatch level. If 'i' is NULL, the level is just incr. /// Start a new cont. backpatch level. If 'i' is NULL, the level is just incr.
void int
new_cont_backpatch(sp_instr_opt_meta *i); new_cont_backpatch(sp_instr_opt_meta *i);
/// Add an instruction to the current level /// Add an instruction to the current level
void int
add_cont_backpatch(sp_instr_opt_meta *i); add_cont_backpatch(sp_instr_opt_meta *i);
/// Backpatch (and pop) the current level to the current position. /// Backpatch (and pop) the current level to the current position.

View File

@ -265,8 +265,8 @@ sp_pcontext::push_variable(LEX_STRING *name, enum enum_field_types type,
p->mode= mode; p->mode= mode;
p->offset= current_var_count(); p->offset= current_var_count();
p->dflt= NULL; p->dflt= NULL;
insert_dynamic(&m_vars, (uchar*)&p); if (insert_dynamic(&m_vars, (uchar*)&p))
return NULL;
return p; return p;
} }
@ -310,18 +310,17 @@ sp_pcontext::find_label(char *name)
return NULL; return NULL;
} }
void int
sp_pcontext::push_cond(LEX_STRING *name, sp_cond_type_t *val) sp_pcontext::push_cond(LEX_STRING *name, sp_cond_type_t *val)
{ {
sp_cond_t *p= (sp_cond_t *)sql_alloc(sizeof(sp_cond_t)); sp_cond_t *p= (sp_cond_t *)sql_alloc(sizeof(sp_cond_t));
if (p) if (p == NULL)
{ return 1;
p->name.str= name->str; p->name.str= name->str;
p->name.length= name->length; p->name.length= name->length;
p->val= val; p->val= val;
insert_dynamic(&m_conds, (uchar*)&p); return insert_dynamic(&m_conds, (uchar *)&p);
}
} }
/* /*
@ -384,7 +383,7 @@ sp_pcontext::find_handler(sp_cond_type_t *cond)
return FALSE; return FALSE;
} }
void int
sp_pcontext::push_cursor(LEX_STRING *name) sp_pcontext::push_cursor(LEX_STRING *name)
{ {
LEX_STRING n; LEX_STRING n;
@ -393,7 +392,7 @@ sp_pcontext::push_cursor(LEX_STRING *name)
m_max_cursor_index+= 1; m_max_cursor_index+= 1;
n.str= name->str; n.str= name->str;
n.length= name->length; n.length= name->length;
insert_dynamic(&m_cursors, (uchar*)&n); return insert_dynamic(&m_cursors, (uchar *)&n);
} }
/* /*

View File

@ -323,7 +323,7 @@ public:
// Conditions // Conditions
// //
void int
push_cond(LEX_STRING *name, sp_cond_type_t *val); push_cond(LEX_STRING *name, sp_cond_type_t *val);
inline void inline void
@ -365,7 +365,7 @@ public:
// Cursors // Cursors
// //
void int
push_cursor(LEX_STRING *name); push_cursor(LEX_STRING *name);
my_bool my_bool

View File

@ -1026,7 +1026,10 @@ int reset_slave(THD *thd, Master_info* mi)
if ((error= purge_relay_logs(&mi->rli, thd, if ((error= purge_relay_logs(&mi->rli, thd,
1 /* just reset */, 1 /* just reset */,
&errmsg))) &errmsg)))
{
sql_errno= ER_RELAY_LOG_FAIL;
goto err; goto err;
}
/* /*
Clear master's log coordinates and reset host/user/etc to the values Clear master's log coordinates and reset host/user/etc to the values

View File

@ -2248,6 +2248,14 @@ JOIN::destroy()
cond_equal= 0; cond_equal= 0;
cleanup(1); cleanup(1);
/* Cleanup items referencing temporary table columns */
if (!tmp_all_fields3.is_empty())
{
List_iterator_fast<Item> it(tmp_all_fields3);
Item *item;
while ((item= it++))
item->cleanup();
}
if (exec_tmp_table1) if (exec_tmp_table1)
free_tmp_table(thd, exec_tmp_table1); free_tmp_table(thd, exec_tmp_table1);
if (exec_tmp_table2) if (exec_tmp_table2)
@ -3476,14 +3484,6 @@ add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level,
} }
} }
/**
Add all keys with uses 'field' for some keypart.
If field->and_level != and_level then only mark key_part as const_part.
@todo
ft-keys in non-ft queries. SerG
*/
static uint static uint
max_part_bit(key_part_map bits) max_part_bit(key_part_map bits)
@ -3493,7 +3493,16 @@ max_part_bit(key_part_map bits)
return found; return found;
} }
static void /*
Add all keys with uses 'field' for some keypart
If field->and_level != and_level then only mark key_part as const_part
RETURN
0 - OK
1 - Out of memory.
*/
static bool
add_key_part(DYNAMIC_ARRAY *keyuse_array,KEY_FIELD *key_field) add_key_part(DYNAMIC_ARRAY *keyuse_array,KEY_FIELD *key_field)
{ {
Field *field=key_field->field; Field *field=key_field->field;
@ -3523,24 +3532,26 @@ add_key_part(DYNAMIC_ARRAY *keyuse_array,KEY_FIELD *key_field)
keyuse.optimize= key_field->optimize & KEY_OPTIMIZE_REF_OR_NULL; keyuse.optimize= key_field->optimize & KEY_OPTIMIZE_REF_OR_NULL;
keyuse.null_rejecting= key_field->null_rejecting; keyuse.null_rejecting= key_field->null_rejecting;
keyuse.cond_guard= key_field->cond_guard; keyuse.cond_guard= key_field->cond_guard;
VOID(insert_dynamic(keyuse_array,(uchar*) &keyuse)); if (insert_dynamic(keyuse_array,(uchar*) &keyuse))
return TRUE;
} }
} }
} }
} }
return FALSE;
} }
#define FT_KEYPART (MAX_REF_PARTS+10) #define FT_KEYPART (MAX_REF_PARTS+10)
static void static bool
add_ft_keys(DYNAMIC_ARRAY *keyuse_array, add_ft_keys(DYNAMIC_ARRAY *keyuse_array,
JOIN_TAB *stat,COND *cond,table_map usable_tables) JOIN_TAB *stat,COND *cond,table_map usable_tables)
{ {
Item_func_match *cond_func=NULL; Item_func_match *cond_func=NULL;
if (!cond) if (!cond)
return; return FALSE;
if (cond->type() == Item::FUNC_ITEM) if (cond->type() == Item::FUNC_ITEM)
{ {
@ -3574,13 +3585,16 @@ add_ft_keys(DYNAMIC_ARRAY *keyuse_array,
{ {
Item *item; Item *item;
while ((item=li++)) while ((item=li++))
add_ft_keys(keyuse_array,stat,item,usable_tables); {
if (add_ft_keys(keyuse_array,stat,item,usable_tables))
return TRUE;
}
} }
} }
if (!cond_func || cond_func->key == NO_SUCH_KEY || if (!cond_func || cond_func->key == NO_SUCH_KEY ||
!(usable_tables & cond_func->table->map)) !(usable_tables & cond_func->table->map))
return; return FALSE;
KEYUSE keyuse; KEYUSE keyuse;
keyuse.table= cond_func->table; keyuse.table= cond_func->table;
@ -3590,7 +3604,7 @@ add_ft_keys(DYNAMIC_ARRAY *keyuse_array,
keyuse.used_tables=cond_func->key_item()->used_tables(); keyuse.used_tables=cond_func->key_item()->used_tables();
keyuse.optimize= 0; keyuse.optimize= 0;
keyuse.keypart_map= 0; keyuse.keypart_map= 0;
VOID(insert_dynamic(keyuse_array,(uchar*) &keyuse)); return insert_dynamic(keyuse_array,(uchar*) &keyuse);
} }
@ -3744,7 +3758,8 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
sargables); sargables);
for (; field != end ; field++) for (; field != end ; field++)
{ {
add_key_part(keyuse,field); if (add_key_part(keyuse,field))
return TRUE;
/* Mark that we can optimize LEFT JOIN */ /* Mark that we can optimize LEFT JOIN */
if (field->val->type() == Item::NULL_ITEM && if (field->val->type() == Item::NULL_ITEM &&
!field->field->real_maybe_null()) !field->field->real_maybe_null())
@ -3782,11 +3797,15 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
/* fill keyuse with found key parts */ /* fill keyuse with found key parts */
for ( ; field != end ; field++) for ( ; field != end ; field++)
add_key_part(keyuse,field); {
if (add_key_part(keyuse,field))
return TRUE;
}
if (select_lex->ftfunc_list->elements) if (select_lex->ftfunc_list->elements)
{ {
add_ft_keys(keyuse,join_tab,cond,normal_tables); if (add_ft_keys(keyuse,join_tab,cond,normal_tables))
return TRUE;
} }
/* /*
@ -3807,7 +3826,8 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
(qsort_cmp) sort_keyuse); (qsort_cmp) sort_keyuse);
bzero((char*) &key_end,sizeof(key_end)); /* Add for easy testing */ bzero((char*) &key_end,sizeof(key_end)); /* Add for easy testing */
VOID(insert_dynamic(keyuse,(uchar*) &key_end)); if (insert_dynamic(keyuse,(uchar*) &key_end))
return TRUE;
use=save_pos=dynamic_element(keyuse,0,KEYUSE*); use=save_pos=dynamic_element(keyuse,0,KEYUSE*);
prev= &key_end; prev= &key_end;
@ -7072,14 +7092,16 @@ return_zero_rows(JOIN *join, select_result *result,TABLE_LIST *tables,
if (!(result->send_fields(fields, if (!(result->send_fields(fields,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))) Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)))
{ {
bool send_error= FALSE;
if (send_row) if (send_row)
{ {
List_iterator_fast<Item> it(fields); List_iterator_fast<Item> it(fields);
Item *item; Item *item;
while ((item= it++)) while ((item= it++))
item->no_rows_in_result(); item->no_rows_in_result();
result->send_data(fields); send_error= result->send_data(fields);
} }
if (!send_error)
result->send_eof(); // Should be safe result->send_eof(); // Should be safe
} }
/* Update results for FOUND_ROWS */ /* Update results for FOUND_ROWS */

View File

@ -3126,7 +3126,7 @@ static bool prepare_blob_field(THD *thd, Create_field *sql_field)
} }
sql_field->sql_type= MYSQL_TYPE_BLOB; sql_field->sql_type= MYSQL_TYPE_BLOB;
sql_field->flags|= BLOB_FLAG; sql_field->flags|= BLOB_FLAG;
sprintf(warn_buff, ER(ER_AUTO_CONVERT), sql_field->field_name, my_snprintf(warn_buff, sizeof(warn_buff), ER(ER_AUTO_CONVERT), sql_field->field_name,
(sql_field->charset == &my_charset_bin) ? "VARBINARY" : "VARCHAR", (sql_field->charset == &my_charset_bin) ? "VARBINARY" : "VARCHAR",
(sql_field->charset == &my_charset_bin) ? "BLOB" : "TEXT"); (sql_field->charset == &my_charset_bin) ? "BLOB" : "TEXT");
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_AUTO_CONVERT, push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_AUTO_CONVERT,

View File

@ -818,7 +818,7 @@ int mysql_update(THD *thd,
if (error < 0) if (error < 0)
{ {
char buff[STRING_BUFFER_USUAL_SIZE]; char buff[STRING_BUFFER_USUAL_SIZE];
sprintf(buff, ER(ER_UPDATE_INFO), (ulong) found, (ulong) updated, my_snprintf(buff, sizeof(buff), ER(ER_UPDATE_INFO), (ulong) found, (ulong) updated,
(ulong) thd->cuted_fields); (ulong) thd->cuted_fields);
thd->row_count_func= thd->row_count_func=
(thd->client_capabilities & CLIENT_FOUND_ROWS) ? found : updated; (thd->client_capabilities & CLIENT_FOUND_ROWS) ? found : updated;
@ -2066,8 +2066,8 @@ bool multi_update::send_eof()
id= thd->arg_of_last_insert_id_function ? id= thd->arg_of_last_insert_id_function ?
thd->first_successful_insert_id_in_prev_stmt : 0; thd->first_successful_insert_id_in_prev_stmt : 0;
sprintf(buff, ER(ER_UPDATE_INFO), (ulong) found, (ulong) updated, my_snprintf(buff, sizeof(buff), ER(ER_UPDATE_INFO),
(ulong) thd->cuted_fields); (ulong) found, (ulong) updated, (ulong) thd->cuted_fields);
thd->row_count_func= thd->row_count_func=
(thd->client_capabilities & CLIENT_FOUND_ROWS) ? found : updated; (thd->client_capabilities & CLIENT_FOUND_ROWS) ? found : updated;
::my_ok(thd, (ulong) thd->row_count_func, id, buff); ::my_ok(thd, (ulong) thd->row_count_func, id, buff);

View File

@ -280,9 +280,7 @@ int case_stmt_action_expr(LEX *lex, Item* expr)
parsing_ctx, case_expr_id, expr, lex); parsing_ctx, case_expr_id, expr, lex);
sp->add_cont_backpatch(i); sp->add_cont_backpatch(i);
sp->add_instr(i); return sp->add_instr(i);
return 0;
} }
/** /**
@ -293,7 +291,7 @@ int case_stmt_action_expr(LEX *lex, Item* expr)
@param simple true for simple cases, false for searched cases @param simple true for simple cases, false for searched cases
*/ */
void case_stmt_action_when(LEX *lex, Item *when, bool simple) int case_stmt_action_when(LEX *lex, Item *when, bool simple)
{ {
sp_head *sp= lex->sphead; sp_head *sp= lex->sphead;
sp_pcontext *ctx= lex->spcont; sp_pcontext *ctx= lex->spcont;
@ -325,8 +323,9 @@ void case_stmt_action_when(LEX *lex, Item *when, bool simple)
(jump_if_not from instruction 2 to 5, 5 to 8 ... in the example) (jump_if_not from instruction 2 to 5, 5 to 8 ... in the example)
*/ */
sp->push_backpatch(i, ctx->push_label((char *)"", 0)); return !test(i) ||
sp->add_cont_backpatch(i); sp->push_backpatch(i, ctx->push_label((char *)"", 0)) ||
sp->add_cont_backpatch(i) ||
sp->add_instr(i); sp->add_instr(i);
} }
@ -336,13 +335,14 @@ void case_stmt_action_when(LEX *lex, Item *when, bool simple)
@param lex the parser lex context @param lex the parser lex context
*/ */
void case_stmt_action_then(LEX *lex) int case_stmt_action_then(LEX *lex)
{ {
sp_head *sp= lex->sphead; sp_head *sp= lex->sphead;
sp_pcontext *ctx= lex->spcont; sp_pcontext *ctx= lex->spcont;
uint ip= sp->instructions(); uint ip= sp->instructions();
sp_instr_jump *i = new sp_instr_jump(ip, ctx); sp_instr_jump *i = new sp_instr_jump(ip, ctx);
sp->add_instr(i); if (!test(i) || sp->add_instr(i))
return 1;
/* /*
BACKPATCH: Resolving forward jump from BACKPATCH: Resolving forward jump from
@ -358,7 +358,7 @@ void case_stmt_action_then(LEX *lex)
(jump from instruction 4 to 12, 7 to 12 ... in the example) (jump from instruction 4 to 12, 7 to 12 ... in the example)
*/ */
sp->push_backpatch(i, ctx->last_label()); return sp->push_backpatch(i, ctx->last_label());
} }
/** /**
@ -2322,10 +2322,9 @@ sp_decl:
var_type, var_type,
lex, lex,
(i == num_vars - 1)); (i == num_vars - 1));
if (is == NULL) if (is == NULL ||
lex->sphead->add_instr(is))
MYSQL_YYABORT; MYSQL_YYABORT;
lex->sphead->add_instr(is);
} }
pctx->declare_var_boundary(0); pctx->declare_var_boundary(0);
@ -2344,7 +2343,8 @@ sp_decl:
my_error(ER_SP_DUP_COND, MYF(0), $2.str); my_error(ER_SP_DUP_COND, MYF(0), $2.str);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
YYTHD->lex->spcont->push_cond(&$2, $5); if(YYTHD->lex->spcont->push_cond(&$2, $5))
MYSQL_YYABORT;
$$.vars= $$.hndlrs= $$.curs= 0; $$.vars= $$.hndlrs= $$.curs= 0;
$$.conds= 1; $$.conds= 1;
} }
@ -2359,10 +2359,10 @@ sp_decl:
sp_instr_hpush_jump *i= sp_instr_hpush_jump *i=
new sp_instr_hpush_jump(sp->instructions(), ctx, $2, new sp_instr_hpush_jump(sp->instructions(), ctx, $2,
ctx->current_var_count()); ctx->current_var_count());
if (i == NULL) if (i == NULL ||
sp->add_instr(i) ||
sp->push_backpatch(i, ctx->push_label((char *)"", 0)))
MYSQL_YYABORT; MYSQL_YYABORT;
sp->add_instr(i);
sp->push_backpatch(i, ctx->push_label((char *)"", 0));
} }
sp_hcond_list sp_proc_stmt sp_hcond_list sp_proc_stmt
{ {
@ -2376,17 +2376,17 @@ sp_decl:
{ {
i= new sp_instr_hreturn(sp->instructions(), ctx, i= new sp_instr_hreturn(sp->instructions(), ctx,
ctx->current_var_count()); ctx->current_var_count());
if (i == NULL) if (i == NULL ||
sp->add_instr(i))
MYSQL_YYABORT; MYSQL_YYABORT;
sp->add_instr(i);
} }
else else
{ /* EXIT or UNDO handler, just jump to the end of the block */ { /* EXIT or UNDO handler, just jump to the end of the block */
i= new sp_instr_hreturn(sp->instructions(), ctx, 0); i= new sp_instr_hreturn(sp->instructions(), ctx, 0);
if (i == NULL) if (i == NULL ||
sp->add_instr(i) ||
sp->push_backpatch(i, lex->spcont->last_label())) /* Block end */
MYSQL_YYABORT; MYSQL_YYABORT;
sp->add_instr(i);
sp->push_backpatch(i, lex->spcont->last_label()); /* Block end */
} }
lex->sphead->backpatch(hlab); lex->sphead->backpatch(hlab);
@ -2412,10 +2412,10 @@ sp_decl:
} }
i= new sp_instr_cpush(sp->instructions(), ctx, $5, i= new sp_instr_cpush(sp->instructions(), ctx, $5,
ctx->current_cursor_count()); ctx->current_cursor_count());
if (i == NULL) if (i == NULL ||
sp->add_instr(i) ||
ctx->push_cursor(&$2))
MYSQL_YYABORT; MYSQL_YYABORT;
sp->add_instr(i);
ctx->push_cursor(&$2);
$$.vars= $$.conds= $$.hndlrs= 0; $$.vars= $$.conds= $$.hndlrs= 0;
$$.curs= 1; $$.curs= 1;
} }
@ -2652,10 +2652,11 @@ sp_proc_stmt_statement:
i->m_query.length= lip->get_ptr() - sp->m_tmp_query; i->m_query.length= lip->get_ptr() - sp->m_tmp_query;
else else
i->m_query.length= lip->get_tok_end() - sp->m_tmp_query; i->m_query.length= lip->get_tok_end() - sp->m_tmp_query;
i->m_query.str= strmake_root(thd->mem_root, if (!(i->m_query.str= strmake_root(thd->mem_root,
sp->m_tmp_query, sp->m_tmp_query,
i->m_query.length); i->m_query.length)) ||
sp->add_instr(i); sp->add_instr(i))
MYSQL_YYABORT;
} }
sp->restore_lex(thd); sp->restore_lex(thd);
} }
@ -2680,9 +2681,9 @@ sp_proc_stmt_return:
i= new sp_instr_freturn(sp->instructions(), lex->spcont, $3, i= new sp_instr_freturn(sp->instructions(), lex->spcont, $3,
sp->m_return_field_def.sql_type, lex); sp->m_return_field_def.sql_type, lex);
if (i == NULL) if (i == NULL ||
sp->add_instr(i))
MYSQL_YYABORT; MYSQL_YYABORT;
sp->add_instr(i);
sp->m_flags|= sp_head::HAS_RETURN; sp->m_flags|= sp_head::HAS_RETURN;
} }
sp->restore_lex(YYTHD); sp->restore_lex(YYTHD);
@ -2779,22 +2780,22 @@ sp_proc_stmt_iterate:
if (n) if (n)
{ {
sp_instr_hpop *hpop= new sp_instr_hpop(ip++, ctx, n); sp_instr_hpop *hpop= new sp_instr_hpop(ip++, ctx, n);
if (hpop == NULL) if (hpop == NULL ||
sp->add_instr(hpop))
MYSQL_YYABORT; MYSQL_YYABORT;
sp->add_instr(hpop);
} }
n= ctx->diff_cursors(lab->ctx, FALSE); /* Inclusive the dest. */ n= ctx->diff_cursors(lab->ctx, FALSE); /* Inclusive the dest. */
if (n) if (n)
{ {
sp_instr_cpop *cpop= new sp_instr_cpop(ip++, ctx, n); sp_instr_cpop *cpop= new sp_instr_cpop(ip++, ctx, n);
if (cpop == NULL) if (cpop == NULL ||
sp->add_instr(cpop))
MYSQL_YYABORT; MYSQL_YYABORT;
sp->add_instr(cpop);
} }
i= new sp_instr_jump(ip, ctx, lab->ip); /* Jump back */ i= new sp_instr_jump(ip, ctx, lab->ip); /* Jump back */
if (i == NULL) if (i == NULL ||
sp->add_instr(i))
MYSQL_YYABORT; MYSQL_YYABORT;
sp->add_instr(i);
} }
} }
; ;
@ -2813,9 +2814,9 @@ sp_proc_stmt_open:
MYSQL_YYABORT; MYSQL_YYABORT;
} }
i= new sp_instr_copen(sp->instructions(), lex->spcont, offset); i= new sp_instr_copen(sp->instructions(), lex->spcont, offset);
if (i == NULL) if (i == NULL ||
sp->add_instr(i))
MYSQL_YYABORT; MYSQL_YYABORT;
sp->add_instr(i);
} }
; ;
@ -2833,9 +2834,9 @@ sp_proc_stmt_fetch:
MYSQL_YYABORT; MYSQL_YYABORT;
} }
i= new sp_instr_cfetch(sp->instructions(), lex->spcont, offset); i= new sp_instr_cfetch(sp->instructions(), lex->spcont, offset);
if (i == NULL) if (i == NULL ||
sp->add_instr(i))
MYSQL_YYABORT; MYSQL_YYABORT;
sp->add_instr(i);
} }
sp_fetch_list sp_fetch_list
{} {}
@ -2855,9 +2856,9 @@ sp_proc_stmt_close:
MYSQL_YYABORT; MYSQL_YYABORT;
} }
i= new sp_instr_cclose(sp->instructions(), lex->spcont, offset); i= new sp_instr_cclose(sp->instructions(), lex->spcont, offset);
if (i == NULL) if (i == NULL ||
sp->add_instr(i))
MYSQL_YYABORT; MYSQL_YYABORT;
sp->add_instr(i);
} }
; ;
@ -2920,12 +2921,11 @@ sp_if:
uint ip= sp->instructions(); uint ip= sp->instructions();
sp_instr_jump_if_not *i = new sp_instr_jump_if_not(ip, ctx, sp_instr_jump_if_not *i = new sp_instr_jump_if_not(ip, ctx,
$2, lex); $2, lex);
if (i == NULL) if (i == NULL ||
sp->push_backpatch(i, ctx->push_label((char *)"", 0)) ||
sp->add_cont_backpatch(i) ||
sp->add_instr(i))
MYSQL_YYABORT; MYSQL_YYABORT;
sp->push_backpatch(i, ctx->push_label((char *)"", 0));
sp->add_cont_backpatch(i);
sp->add_instr(i);
sp->restore_lex(YYTHD); sp->restore_lex(YYTHD);
} }
sp_proc_stmts1 sp_proc_stmts1
@ -2934,10 +2934,9 @@ sp_if:
sp_pcontext *ctx= Lex->spcont; sp_pcontext *ctx= Lex->spcont;
uint ip= sp->instructions(); uint ip= sp->instructions();
sp_instr_jump *i = new sp_instr_jump(ip, ctx); sp_instr_jump *i = new sp_instr_jump(ip, ctx);
if (i == NULL) if (i == NULL ||
sp->add_instr(i))
MYSQL_YYABORT; MYSQL_YYABORT;
sp->add_instr(i);
sp->backpatch(ctx->pop_label()); sp->backpatch(ctx->pop_label());
sp->push_backpatch(i, ctx->push_label((char *)"", 0)); sp->push_backpatch(i, ctx->push_label((char *)"", 0));
} }
@ -3021,14 +3020,16 @@ simple_when_clause:
/* Simple case: <caseval> = <whenval> */ /* Simple case: <caseval> = <whenval> */
LEX *lex= Lex; LEX *lex= Lex;
case_stmt_action_when(lex, $3, true); if (case_stmt_action_when(lex, $3, true))
MYSQL_YYABORT;
lex->sphead->restore_lex(YYTHD); /* For expr $3 */ lex->sphead->restore_lex(YYTHD); /* For expr $3 */
} }
THEN_SYM THEN_SYM
sp_proc_stmts1 sp_proc_stmts1
{ {
LEX *lex= Lex; LEX *lex= Lex;
case_stmt_action_then(lex); if (case_stmt_action_then(lex))
MYSQL_YYABORT;
} }
; ;
@ -3040,14 +3041,16 @@ searched_when_clause:
expr expr
{ {
LEX *lex= Lex; LEX *lex= Lex;
case_stmt_action_when(lex, $3, false); if (case_stmt_action_when(lex, $3, false))
MYSQL_YYABORT;
lex->sphead->restore_lex(YYTHD); /* For expr $3 */ lex->sphead->restore_lex(YYTHD); /* For expr $3 */
} }
THEN_SYM THEN_SYM
sp_proc_stmts1 sp_proc_stmts1
{ {
LEX *lex= Lex; LEX *lex= Lex;
case_stmt_action_then(lex); if (case_stmt_action_then(lex))
MYSQL_YYABORT;
} }
; ;
@ -3059,9 +3062,9 @@ else_clause_opt:
uint ip= sp->instructions(); uint ip= sp->instructions();
sp_instr_error *i= new sp_instr_error(ip, lex->spcont, sp_instr_error *i= new sp_instr_error(ip, lex->spcont,
ER_SP_CASE_NOT_FOUND); ER_SP_CASE_NOT_FOUND);
if (i == NULL) if (i == NULL ||
sp->add_instr(i))
MYSQL_YYABORT; MYSQL_YYABORT;
sp->add_instr(i);
} }
| ELSE sp_proc_stmts1 | ELSE sp_proc_stmts1
; ;
@ -3175,16 +3178,16 @@ sp_block_content:
if ($3.hndlrs) if ($3.hndlrs)
{ {
i= new sp_instr_hpop(sp->instructions(), ctx, $3.hndlrs); i= new sp_instr_hpop(sp->instructions(), ctx, $3.hndlrs);
if (i == NULL) if (i == NULL ||
sp->add_instr(i))
MYSQL_YYABORT; MYSQL_YYABORT;
sp->add_instr(i);
} }
if ($3.curs) if ($3.curs)
{ {
i= new sp_instr_cpop(sp->instructions(), ctx, $3.curs); i= new sp_instr_cpop(sp->instructions(), ctx, $3.curs);
if (i == NULL) if (i == NULL ||
sp->add_instr(i))
MYSQL_YYABORT; MYSQL_YYABORT;
sp->add_instr(i);
} }
lex->spcont= ctx->pop_context(); lex->spcont= ctx->pop_context();
} }
@ -3198,9 +3201,9 @@ sp_unlabeled_control:
uint ip= lex->sphead->instructions(); uint ip= lex->sphead->instructions();
sp_label_t *lab= lex->spcont->last_label(); /* Jumping back */ sp_label_t *lab= lex->spcont->last_label(); /* Jumping back */
sp_instr_jump *i = new sp_instr_jump(ip, lex->spcont, lab->ip); sp_instr_jump *i = new sp_instr_jump(ip, lex->spcont, lab->ip);
if (i == NULL) if (i == NULL ||
lex->sphead->add_instr(i))
MYSQL_YYABORT; MYSQL_YYABORT;
lex->sphead->add_instr(i);
} }
| WHILE_SYM | WHILE_SYM
{ Lex->sphead->reset_lex(YYTHD); } { Lex->sphead->reset_lex(YYTHD); }
@ -3211,12 +3214,12 @@ sp_unlabeled_control:
uint ip= sp->instructions(); uint ip= sp->instructions();
sp_instr_jump_if_not *i = new sp_instr_jump_if_not(ip, lex->spcont, sp_instr_jump_if_not *i = new sp_instr_jump_if_not(ip, lex->spcont,
$3, lex); $3, lex);
if (i == NULL) if (i == NULL ||
MYSQL_YYABORT;
/* Jumping forward */ /* Jumping forward */
sp->push_backpatch(i, lex->spcont->last_label()); sp->push_backpatch(i, lex->spcont->last_label()) ||
sp->new_cont_backpatch(i); sp->new_cont_backpatch(i) ||
sp->add_instr(i); sp->add_instr(i))
MYSQL_YYABORT;
sp->restore_lex(YYTHD); sp->restore_lex(YYTHD);
} }
sp_proc_stmts1 END WHILE_SYM sp_proc_stmts1 END WHILE_SYM
@ -3225,9 +3228,9 @@ sp_unlabeled_control:
uint ip= lex->sphead->instructions(); uint ip= lex->sphead->instructions();
sp_label_t *lab= lex->spcont->last_label(); /* Jumping back */ sp_label_t *lab= lex->spcont->last_label(); /* Jumping back */
sp_instr_jump *i = new sp_instr_jump(ip, lex->spcont, lab->ip); sp_instr_jump *i = new sp_instr_jump(ip, lex->spcont, lab->ip);
if (i == NULL) if (i == NULL ||
lex->sphead->add_instr(i))
MYSQL_YYABORT; MYSQL_YYABORT;
lex->sphead->add_instr(i);
lex->sphead->do_cont_backpatch(); lex->sphead->do_cont_backpatch();
} }
| REPEAT_SYM sp_proc_stmts1 UNTIL_SYM | REPEAT_SYM sp_proc_stmts1 UNTIL_SYM
@ -3240,9 +3243,9 @@ sp_unlabeled_control:
sp_instr_jump_if_not *i = new sp_instr_jump_if_not(ip, lex->spcont, sp_instr_jump_if_not *i = new sp_instr_jump_if_not(ip, lex->spcont,
$5, lab->ip, $5, lab->ip,
lex); lex);
if (i == NULL) if (i == NULL ||
lex->sphead->add_instr(i))
MYSQL_YYABORT; MYSQL_YYABORT;
lex->sphead->add_instr(i);
lex->sphead->restore_lex(YYTHD); lex->sphead->restore_lex(YYTHD);
/* We can shortcut the cont_backpatch here */ /* We can shortcut the cont_backpatch here */
i->m_cont_dest= ip+1; i->m_cont_dest= ip+1;
@ -11751,7 +11754,8 @@ option_type_value:
qbuff.length); qbuff.length);
qbuff.length+= 4; qbuff.length+= 4;
i->m_query= qbuff; i->m_query= qbuff;
sp->add_instr(i); if (sp->add_instr(i))
MYSQL_YYABORT;
} }
lex->sphead->restore_lex(thd); lex->sphead->restore_lex(thd);
} }
@ -11843,7 +11847,8 @@ sys_option_value:
(uchar **) &trg_fld-> (uchar **) &trg_fld->
next_trg_field); next_trg_field);
lex->sphead->add_instr(sp_fld); if (lex->sphead->add_instr(sp_fld))
MYSQL_YYABORT;
} }
else if ($2.var) else if ($2.var)
{ /* System variable */ { /* System variable */
@ -11882,9 +11887,9 @@ sys_option_value:
} }
sp_set= new sp_instr_set(lex->sphead->instructions(), ctx, sp_set= new sp_instr_set(lex->sphead->instructions(), ctx,
spv->offset, it, spv->type, lex, TRUE); spv->offset, it, spv->type, lex, TRUE);
if (sp_set == NULL) if (sp_set == NULL ||
lex->sphead->add_instr(sp_set))
MYSQL_YYABORT; MYSQL_YYABORT;
lex->sphead->add_instr(sp_set);
} }
} }
| option_type TRANSACTION_SYM ISOLATION LEVEL_SYM isolation_types | option_type TRANSACTION_SYM ISOLATION LEVEL_SYM isolation_types

View File

@ -37,8 +37,7 @@ static bool pack_header(uchar *forminfo,enum legacy_db_type table_type,
List<Create_field> &create_fields, List<Create_field> &create_fields,
uint info_length, uint screens, uint table_options, uint info_length, uint screens, uint table_options,
ulong data_offset, handler *file); ulong data_offset, handler *file);
static uint get_interval_id(uint *int_count,List<Create_field> &create_fields, static uint get_interval_id(uint *,List<Create_field> &, Create_field *);
Create_field *last_field);
static bool pack_fields(File file, List<Create_field> &create_fields, static bool pack_fields(File file, List<Create_field> &create_fields,
ulong data_offset); ulong data_offset);
static bool make_empty_rec(THD *thd, int file, enum legacy_db_type table_type, static bool make_empty_rec(THD *thd, int file, enum legacy_db_type table_type,

View File

@ -27,6 +27,7 @@ DEFS = @DEFS@
noinst_HEADERS = ha_ibmdb2i.h db2i_collationSupport.h db2i_file.h \ noinst_HEADERS = ha_ibmdb2i.h db2i_collationSupport.h db2i_file.h \
db2i_ioBuffers.h db2i_blobCollection.h \ db2i_ioBuffers.h db2i_blobCollection.h \
db2i_global.h db2i_misc.h db2i_charsetSupport.h db2i_errors.h \ db2i_global.h db2i_misc.h db2i_charsetSupport.h db2i_errors.h \
db2i_iconv.h db2i_myconv.h db2i_safeString.h db2i_sqlStatementStream.h \
db2i_ileBridge.h db2i_validatedPointer.h db2i_ileBridge.h db2i_validatedPointer.h
EXTRA_LTLIBRARIES = ha_ibmdb2i.la EXTRA_LTLIBRARIES = ha_ibmdb2i.la

View File

@ -267,10 +267,17 @@ static int32 getNewTextDesc(const int32 inType,
signature, signature,
RESULT_INT32); RESULT_INT32);
if (unlikely(arguments->base.result.s_int32.r_int32 < 0)) if (unlikely(arguments->base.result.s_int32.r_int32 < 0))
{
if (arguments->base.result.s_int32.r_int32 == Qlg_InDescriptorNotFound)
{
DBUG_RETURN(DB2I_ERR_UNSUPP_CHARSET);
}
else
{ {
getErrTxt(DB2I_ERR_ILECALL,"QlgCvtTextDescToDesc",arguments->base.result.s_int32.r_int32); getErrTxt(DB2I_ERR_ILECALL,"QlgCvtTextDescToDesc",arguments->base.result.s_int32.r_int32);
DBUG_RETURN(DB2I_ERR_ILECALL); DBUG_RETURN(DB2I_ERR_ILECALL);
} }
}
// Store the conversion information into a cache entry // Store the conversion information into a cache entry
TextDescMap* mapping = (TextDescMap*)alloc_root(&textDescMapMemroot, sizeof(TextDescMap)); TextDescMap* mapping = (TextDescMap*)alloc_root(&textDescMapMemroot, sizeof(TextDescMap));
@ -428,8 +435,13 @@ int32 convertIANAToDb2Ccsid(const char* parmIANADesc, uint16* db2Ccsid)
int aixEncodingScheme; int aixEncodingScheme;
int db2EncodingScheme; int db2EncodingScheme;
rc = convertTextDesc(Qlg_TypeIANA, Qlg_TypeAS400CCSID, parmIANADesc, aixCcsidString); rc = convertTextDesc(Qlg_TypeIANA, Qlg_TypeAS400CCSID, parmIANADesc, aixCcsidString);
if (rc != 0) if (unlikely(rc))
{
if (rc == DB2I_ERR_UNSUPP_CHARSET)
getErrTxt(DB2I_ERR_UNSUPP_CHARSET, parmIANADesc);
return rc; return rc;
}
aixCcsid = atoi(aixCcsidString); aixCcsid = atoi(aixCcsidString);
rc = getEncodingScheme(aixCcsid, aixEncodingScheme); rc = getEncodingScheme(aixCcsid, aixEncodingScheme);
if (rc != 0) if (rc != 0)
@ -646,32 +658,38 @@ static int32 openNewConversion(enum_conversionDirection direction,
there equivalent iconv descriptions. there equivalent iconv descriptions.
*/ */
rc = convertTextDesc(Qlg_TypeIANA, Qlg_TypeAix41, mysqlCSName, mysqlAix41Desc); rc = convertTextDesc(Qlg_TypeIANA, Qlg_TypeAix41, mysqlCSName, mysqlAix41Desc);
if (rc) if (unlikely(rc))
{
if (rc == DB2I_ERR_UNSUPP_CHARSET)
getErrTxt(DB2I_ERR_UNSUPP_CHARSET, mysqlCSName);
DBUG_RETURN(rc); DBUG_RETURN(rc);
}
CHARSET_INFO *cs= &my_charset_bin; CHARSET_INFO *cs= &my_charset_bin;
(uint)(cs->cset->long10_to_str)(cs,db2CcsidString,sizeof(db2CcsidString), 10, db2CCSID); (uint)(cs->cset->long10_to_str)(cs,db2CcsidString,sizeof(db2CcsidString), 10, db2CCSID);
rc = convertTextDesc(Qlg_TypeAS400CCSID, Qlg_TypeAix41, db2CcsidString, db2Aix41Desc); rc = convertTextDesc(Qlg_TypeAS400CCSID, Qlg_TypeAix41, db2CcsidString, db2Aix41Desc);
if (rc) if (unlikely(rc))
{
if (rc == DB2I_ERR_UNSUPP_CHARSET)
getErrTxt(DB2I_ERR_UNSUPP_CHARSET, mysqlCSName);
DBUG_RETURN(rc); DBUG_RETURN(rc);
}
/* Call iconv to open the conversion. */ /* Call iconv to open the conversion. */
if (direction == toDB2) if (direction == toDB2)
{ {
newConversion = iconv_open(db2Aix41Desc, mysqlAix41Desc); newConversion = iconv_open(db2Aix41Desc, mysqlAix41Desc);
if (newConversion == (iconv_t) -1)
{
getErrTxt(DB2I_ERR_ICONV_OPEN, mysqlAix41Desc, db2Aix41Desc, errno);
DBUG_RETURN(DB2I_ERR_ICONV_OPEN);
}
} }
else else
{ {
newConversion = iconv_open(mysqlAix41Desc, db2Aix41Desc); newConversion = iconv_open(mysqlAix41Desc, db2Aix41Desc);
if (newConversion == (iconv_t) -1)
{
getErrTxt(DB2I_ERR_ICONV_OPEN, db2Aix41Desc, mysqlAix41Desc, errno);
DBUG_RETURN(DB2I_ERR_ICONV_OPEN);
} }
if (unlikely(newConversion == (iconv_t) -1))
{
getErrTxt(DB2I_ERR_UNSUPP_CHARSET, mysqlCSName);
DBUG_RETURN(DB2I_ERR_UNSUPP_CHARSET);
} }
/* Insert the new conversion into the cache. */ /* Insert the new conversion into the cache. */

View File

@ -151,7 +151,7 @@ int ha_ibmdb2i::convertFieldChars(enum_conversionDirection direction,
if (unlikely(conversion == (iconv_t)(-1))) if (unlikely(conversion == (iconv_t)(-1)))
{ {
return (DB2I_ERR_ICONV_OPEN); return (DB2I_ERR_UNSUPP_CHARSET);
} }
size_t initOLen= olen; size_t initOLen= olen;
@ -670,6 +670,13 @@ int ha_ibmdb2i::getFieldTypeMapping(Field* field,
if (rtnCode) if (rtnCode)
return rtnCode; return rtnCode;
} }
// Check whether there is a character conversion available.
iconv_t temp;
int32 rc = getConversion(toDB2, fieldCharSet, db2Ccsid, temp);
if (unlikely(rc))
return rc;
sprintf(stringBuildBuffer, " CCSID %d ", db2Ccsid); sprintf(stringBuildBuffer, " CCSID %d ", db2Ccsid);
mapping.append(stringBuildBuffer); mapping.append(stringBuildBuffer);
} }

View File

@ -52,7 +52,7 @@ static const char* engineErrors[MAX_MSGSTRING] =
{"Error opening codeset conversion from %.64s to %.64s (errno = %d)"}, {"Error opening codeset conversion from %.64s to %.64s (errno = %d)"},
{"Invalid %-.10s name '%-.128s'"}, {"Invalid %-.10s name '%-.128s'"},
{"Unsupported move from '%-.128s' to '%-.128s' on RENAME TABLE statement"}, {"Unsupported move from '%-.128s' to '%-.128s' on RENAME TABLE statement"},
{"Unsupported schema '%-.128s' specified on RENAME TABLE statement"}, {"The %-.64s character set is not supported."},
{"Auto_increment is not allowed for a partitioned table"}, {"Auto_increment is not allowed for a partitioned table"},
{"Character set conversion error due to unknown encoding scheme %d"}, {"Character set conversion error due to unknown encoding scheme %d"},
{""}, {""},

View File

@ -54,7 +54,7 @@ enum DB2I_errors
DB2I_ERR_ICONV_OPEN, DB2I_ERR_ICONV_OPEN,
DB2I_ERR_INVALID_NAME, DB2I_ERR_INVALID_NAME,
DB2I_ERR_RENAME_MOVE, DB2I_ERR_RENAME_MOVE,
DB2I_ERR_RENAME_QTEMP, DB2I_ERR_UNSUPP_CHARSET,
DB2I_ERR_PART_AUTOINC, DB2I_ERR_PART_AUTOINC,
DB2I_ERR_UNKNOWN_ENCODING, DB2I_ERR_UNKNOWN_ENCODING,
DB2I_ERR_RESERVED, DB2I_ERR_RESERVED,

View File

@ -898,6 +898,8 @@ int ha_ibmdb2i::index_init(uint idx, bool sorted)
releaseIndexFile(idx); releaseIndexFile(idx);
} }
rrnAssocHandle= 0;
DBUG_RETURN(rc); DBUG_RETURN(rc);
} }
@ -1154,6 +1156,8 @@ int ha_ibmdb2i::rnd_init(bool scan)
releaseDataFile(); releaseDataFile();
} }
rrnAssocHandle= 0;
DBUG_RETURN(0); // MySQL sometimes does not check the return code, causing DBUG_RETURN(0); // MySQL sometimes does not check the return code, causing
// an assert in ha_rnd_end later on if we return a non-zero // an assert in ha_rnd_end later on if we return a non-zero
// value here. // value here.
@ -1251,7 +1255,8 @@ int ha_ibmdb2i::rnd_pos(uchar * buf, uchar *pos)
int rc = 0; int rc = 0;
if (activeHandle != rrnAssocHandle) if (rrnAssocHandle &&
(activeHandle != rrnAssocHandle))
{ {
if (activeHandle) releaseActiveHandle(); if (activeHandle) releaseActiveHandle();
rc = useFileByHandle(QMY_UPDATABLE, rrnAssocHandle); rc = useFileByHandle(QMY_UPDATABLE, rrnAssocHandle);

View File

@ -335,7 +335,23 @@ static int _ftb_no_dupes_cmp(void* not_used __attribute__((unused)),
return CMP_NUM((*((my_off_t*)a)), (*((my_off_t*)b))); return CMP_NUM((*((my_off_t*)a)), (*((my_off_t*)b)));
} }
/* returns 1 if the search was finished (must-word wasn't found) */ /*
When performing prefix search (a word with truncation operator), we
must preserve original prefix to ensure that characters which may be
expanded/contracted do not break the prefix. This is done by storing
newly found key immediatly after the original word in ftbw->word
buffer.
ftbw->word= LENGTH WORD [ LENGTH1 WORD1 ] WEIGHT REFERENCE
LENGTH - 1 byte, length of the WORD
WORD - LENGTH bytes, the word itself
LENGTH1 - 1 byte, length of the WORD1, present in case of prefix search
WORD1 - LENGTH bytes, the word itself, present in case of prefix search
WEIGHT - 4 bytes (HA_FT_WLEN), either weight or number of subkeys
REFERENCE - rec_reflength bytes, pointer to the record
returns 1 if the search was finished (must-word wasn't found)
*/
static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search) static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search)
{ {
int r; int r;
@ -369,7 +385,8 @@ static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search)
if (ftbw->docid[0] < max_docid) if (ftbw->docid[0] < max_docid)
{ {
sflag|= SEARCH_SAME; sflag|= SEARCH_SAME;
_mi_dpointer(info, (uchar *)(ftbw->word + ftbw->len + HA_FT_WLEN), _mi_dpointer(info, (uchar*) (lastkey_buf + HA_FT_WLEN +
(ftbw->off ? 0 : lastkey_buf[0] + 1)),
max_docid); max_docid);
} }
r=_mi_search(info, ftbw->keyinfo, (uchar*) lastkey_buf, r=_mi_search(info, ftbw->keyinfo, (uchar*) lastkey_buf,

View File

@ -43,6 +43,28 @@ TYPELIB myisam_stats_method_typelib= {
array_elements(myisam_stats_method_names) - 1, "", array_elements(myisam_stats_method_names) - 1, "",
myisam_stats_method_names, NULL}; myisam_stats_method_names, NULL};
#ifndef DBUG_OFF
/**
Causes the thread to wait in a spin lock for a query kill signal.
This function is used by the test frame work to identify race conditions.
The signal is caught and ignored and the thread is not killed.
*/
static void debug_wait_for_kill(const char *info)
{
DBUG_ENTER("debug_wait_for_kill");
const char *prev_info;
THD *thd;
thd= current_thd;
prev_info= thd_proc_info(thd, info);
while(!thd->killed)
my_sleep(1000);
DBUG_PRINT("info", ("Exit debug_wait_for_kill"));
thd_proc_info(thd, prev_info);
DBUG_VOID_RETURN;
}
#endif
/***************************************************************************** /*****************************************************************************
** MyISAM tables ** MyISAM tables
@ -392,7 +414,7 @@ int check_definition(MI_KEYDEF *t1_keyinfo, MI_COLUMNDEF *t1_recinfo,
test(t2_keyinfo[i].flag & HA_SPATIAL))); test(t2_keyinfo[i].flag & HA_SPATIAL)));
DBUG_RETURN(1); DBUG_RETURN(1);
} }
if ((mysql_40_compat && if ((!mysql_40_compat &&
t1_keyinfo[i].key_alg != t2_keyinfo[i].key_alg) || t1_keyinfo[i].key_alg != t2_keyinfo[i].key_alg) ||
t1_keyinfo[i].keysegs != t2_keyinfo[i].keysegs) t1_keyinfo[i].keysegs != t2_keyinfo[i].keysegs)
{ {
@ -424,7 +446,7 @@ int check_definition(MI_KEYDEF *t1_keyinfo, MI_COLUMNDEF *t1_recinfo,
t1_keysegs_j__type= HA_KEYTYPE_VARBINARY1; /* purecov: inspected */ t1_keysegs_j__type= HA_KEYTYPE_VARBINARY1; /* purecov: inspected */
} }
if ((mysql_40_compat && if ((!mysql_40_compat &&
t1_keysegs[j].language != t2_keysegs[j].language) || t1_keysegs[j].language != t2_keysegs[j].language) ||
t1_keysegs_j__type != t2_keysegs[j].type || t1_keysegs_j__type != t2_keysegs[j].type ||
t1_keysegs[j].null_bit != t2_keysegs[j].null_bit || t1_keysegs[j].null_bit != t2_keysegs[j].null_bit ||
@ -1395,6 +1417,9 @@ int ha_myisam::enable_indexes(uint mode)
{ {
int error; int error;
DBUG_EXECUTE_IF("wait_in_enable_indexes",
debug_wait_for_kill("wait_in_enable_indexes"); );
if (mi_is_all_keys_active(file->s->state.key_map, file->s->base.keys)) if (mi_is_all_keys_active(file->s->state.key_map, file->s->base.keys))
{ {
/* All indexes are enabled already. */ /* All indexes are enabled already. */
@ -1508,8 +1533,9 @@ void ha_myisam::start_bulk_insert(ha_rows rows)
/* /*
Only disable old index if the table was empty and we are inserting Only disable old index if the table was empty and we are inserting
a lot of rows. a lot of rows.
We should not do this for only a few rows as this is slower and Note that in end_bulk_insert() we may truncate the table if
we don't want to update the key statistics based of only a few rows. enable_indexes() failed, thus it's essential that indexes are
disabled ONLY for an empty table.
*/ */
if (file->state->records == 0 && can_enable_indexes && if (file->state->records == 0 && can_enable_indexes &&
(!rows || rows >= MI_MIN_ROWS_TO_DISABLE_INDEXES)) (!rows || rows >= MI_MIN_ROWS_TO_DISABLE_INDEXES))
@ -1541,8 +1567,27 @@ int ha_myisam::end_bulk_insert()
{ {
mi_end_bulk_insert(file); mi_end_bulk_insert(file);
int err=mi_extra(file, HA_EXTRA_NO_CACHE, 0); int err=mi_extra(file, HA_EXTRA_NO_CACHE, 0);
return err ? err : can_enable_indexes ? if (!err)
enable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE) : 0; {
if (can_enable_indexes)
{
/*
Truncate the table when enable index operation is killed.
After truncating the table we don't need to enable the
indexes, because the last repair operation is aborted after
setting the indexes as active and trying to recreate them.
*/
if (((err= enable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE)) != 0) &&
current_thd->killed)
{
delete_all_rows();
/* not crashed, despite being killed during repair */
file->s->state.changed&= ~(STATE_CRASHED|STATE_CRASHED_ON_REPAIR);
}
}
}
return err;
} }

View File

@ -250,7 +250,11 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
if (info->ft1_to_ft2) if (info->ft1_to_ft2)
{ {
/* we're in ft1->ft2 conversion mode. Saving key data */ /* we're in ft1->ft2 conversion mode. Saving key data */
insert_dynamic(info->ft1_to_ft2, (lastkey+off)); if (insert_dynamic(info->ft1_to_ft2, (lastkey+off)))
{
DBUG_PRINT("error",("Out of memory"));
DBUG_RETURN(-1);
}
} }
else else
{ {

View File

@ -1160,7 +1160,8 @@ uchar *mi_keyseg_read(uchar *ptr, HA_KEYSEG *keyseg)
keyseg->null_pos = mi_uint4korr(ptr); ptr +=4; keyseg->null_pos = mi_uint4korr(ptr); ptr +=4;
keyseg->charset=0; /* Will be filled in later */ keyseg->charset=0; /* Will be filled in later */
if (keyseg->null_bit) if (keyseg->null_bit)
keyseg->bit_pos= (uint16)(keyseg->null_pos + (keyseg->null_bit == 7)); /* We adjust bit_pos if null_bit is last in the byte */
keyseg->bit_pos= (uint16)(keyseg->null_pos + (keyseg->null_bit == (1 << 7)));
else else
{ {
keyseg->bit_pos= (uint16)keyseg->null_pos; keyseg->bit_pos= (uint16)keyseg->null_pos;

View File

@ -562,7 +562,14 @@ int _mi_insert(register MI_INFO *info, register MI_KEYDEF *keyinfo,
we cannot easily dispatch an empty page here */ we cannot easily dispatch an empty page here */
b+=blen+ft2len+2; b+=blen+ft2len+2;
for (a=anc_buff+a_length ; b < a ; b+=ft2len+2) for (a=anc_buff+a_length ; b < a ; b+=ft2len+2)
insert_dynamic(info->ft1_to_ft2, b); {
if (insert_dynamic(info->ft1_to_ft2, b))
{
mi_print_error(info->s, HA_ERR_OUT_OF_MEM);
my_errno= HA_ERR_OUT_OF_MEM;
DBUG_RETURN(-1);
}
}
/* fixing the page's length - it contains only one key now */ /* fixing the page's length - it contains only one key now */
mi_putint(anc_buff,2+blen+ft2len+2,0); mi_putint(anc_buff,2+blen+ft2len+2,0);

View File

@ -5489,10 +5489,10 @@ static MY_CHARSET_HANDLER my_charset_handler=
my_mb_wc_cp932, /* mb_wc */ my_mb_wc_cp932, /* mb_wc */
my_wc_mb_cp932, /* wc_mb */ my_wc_mb_cp932, /* wc_mb */
my_mb_ctype_mb, my_mb_ctype_mb,
my_caseup_str_8bit, my_caseup_str_mb,
my_casedn_str_8bit, my_casedn_str_mb,
my_caseup_8bit, my_caseup_mb,
my_casedn_8bit, my_casedn_mb,
my_snprintf_8bit, my_snprintf_8bit,
my_long10_to_str_8bit, my_long10_to_str_8bit,
my_longlong10_to_str_8bit, my_longlong10_to_str_8bit,

View File

@ -4650,10 +4650,10 @@ static MY_CHARSET_HANDLER my_charset_handler=
my_mb_wc_sjis, /* mb_wc */ my_mb_wc_sjis, /* mb_wc */
my_wc_mb_sjis, /* wc_mb */ my_wc_mb_sjis, /* wc_mb */
my_mb_ctype_mb, my_mb_ctype_mb,
my_caseup_str_8bit, my_caseup_str_mb,
my_casedn_str_8bit, my_casedn_str_mb,
my_caseup_8bit, my_caseup_mb,
my_casedn_8bit, my_casedn_mb,
my_snprintf_8bit, my_snprintf_8bit,
my_long10_to_str_8bit, my_long10_to_str_8bit,
my_longlong10_to_str_8bit, my_longlong10_to_str_8bit,

View File

@ -16555,61 +16555,6 @@ static void test_change_user()
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
#ifdef HAVE_SPATIAL
/**
Bug#37956 memory leak and / or crash with geometry and prepared statements!
*/
static void test_bug37956(void)
{
const char *query="select point(?,?)";
MYSQL_STMT *stmt=NULL;
ulong val=0;
MYSQL_BIND bind_param[2];
unsigned char buff[2]= { 134, 211 };
DBUG_ENTER("test_bug37956");
myheader("test_bug37956");
stmt= mysql_simple_prepare(mysql, query);
check_stmt(stmt);
val=1;
mysql_stmt_attr_set(stmt, STMT_ATTR_UPDATE_MAX_LENGTH, (void *)&val);
val=CURSOR_TYPE_READ_ONLY;
mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void *)&val);
val=0;
mysql_stmt_attr_set(stmt, STMT_ATTR_PREFETCH_ROWS, (void *)&val);
memset(bind_param, 0, sizeof(bind_param));
bind_param[0].buffer_type=MYSQL_TYPE_TINY;
bind_param[0].buffer= (void *)buff;
bind_param[0].is_null=NULL;
bind_param[0].error=NULL;
bind_param[0].is_unsigned=1;
bind_param[1].buffer_type=MYSQL_TYPE_TINY;
bind_param[1].buffer= (void *)(buff+1);
bind_param[1].is_null=NULL;
bind_param[1].error=NULL;
bind_param[1].is_unsigned=1;
if (mysql_stmt_bind_param(stmt, bind_param))
{
mysql_stmt_close(stmt);
DIE_UNLESS(0);
}
if (mysql_stmt_execute(stmt))
{
mysql_stmt_close(stmt);
DBUG_VOID_RETURN;
}
/* Should never reach here: execution returns an error. */
mysql_stmt_close(stmt);
DIE_UNLESS(0);
DBUG_VOID_RETURN;
}
#endif
/* /*
Bug#27592 (stack overrun when storing datetime value using prepared statements) Bug#27592 (stack overrun when storing datetime value using prepared statements)
*/ */
@ -18145,9 +18090,6 @@ static struct my_tests_st my_tests[]= {
{ "test_wl4166_2", test_wl4166_2 }, { "test_wl4166_2", test_wl4166_2 },
{ "test_bug38486", test_bug38486 }, { "test_bug38486", test_bug38486 },
{ "test_bug40365", test_bug40365 }, { "test_bug40365", test_bug40365 },
#ifdef HAVE_SPATIAL
{ "test_bug37956", test_bug37956 },
#endif
#ifdef HAVE_QUERY_CACHE #ifdef HAVE_QUERY_CACHE
{ "test_bug36326", test_bug36326 }, { "test_bug36326", test_bug36326 },
#endif #endif