1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Merge 10.0.14 into 10.1

This commit is contained in:
Sergei Golubchik
2014-10-15 12:59:13 +02:00
2115 changed files with 87968 additions and 80173 deletions

View File

@ -0,0 +1,9 @@
#
# Create a table with all byte values
#
CREATE TABLE halfs (a INT);
INSERT INTO halfs VALUES (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07);
INSERT INTO halfs VALUES (0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
CREATE TEMPORARY TABLE bytes (a BINARY(1), KEY(a)) ENGINE=MyISAM;
INSERT INTO bytes SELECT CHAR((t1.a << 4) | t2.a USING BINARY) FROM halfs t1, halfs t2;
DROP TABLE halfs;

View File

@ -0,0 +1,21 @@
#
# Create a table with all 2 byte sequence values
#
--source include/bytes.inc
CREATE TABLE halfs (a BINARY(1));
# "bytes" is a temporary table, hence is not allowed in joins
# Create a non-temporary copy.
INSERT INTO halfs SELECT * FROM bytes;
CREATE TEMPORARY TABLE bytes2 (
a BINARY(2),
hi BINARY(1),
lo BINARY(1),
KEY(a),
KEY(lo)
) ENGINE=MyISAM;
INSERT INTO bytes2
SELECT CONCAT(t1.a, t2.a), t1.a, t2.a FROM halfs t1, halfs t2
ORDER BY t1.a, t2.a;
DROP TABLE halfs;

View File

@ -0,0 +1,111 @@
--echo # Start of ctype_E05C.inc
#
# A shared test for character sets big5, cp932, gbk, sjis
# They all can have 0x5C as the second byte in a multi-byte character.
# 0xE05C is one of such characters.
#
# Checking that the character 0xE05C correctly understands 5C as the second byte
# rather than a stand-alone backslash, including the strings that also
# have real backslash escapes and/or separator escapes.
SELECT HEX('<27>\'),HEX('<EFBFBD>\t');
SELECT HEX('\\<5C>\'),HEX('\\<5C>\t'),HEX('\\<5C>\t\t');
SELECT HEX('''<EFBFBD>\'),HEX('<EFBFBD>\''');
SELECT HEX('\\''<EFBFBD>\'),HEX('<EFBFBD>\''\\');
SELECT HEX(BINARY('<EFBFBD>\')),HEX(BINARY('<EFBFBD>\t'));
SELECT HEX(BINARY('\\<5C>\')),HEX(BINARY('\\<5C>\t')),HEX(BINARY('\\<5C>\t\t'));
SELECT HEX(BINARY('''<EFBFBD>\')),HEX(BINARY('<EFBFBD>\'''));
SELECT HEX(BINARY('\\''<EFBFBD>\')),HEX(BINARY('<EFBFBD>\''\\'));
SELECT HEX(_BINARY'<EFBFBD>\'),HEX(_BINARY'<EFBFBD>\t');
SELECT HEX(_BINARY'\\<5C>\'),HEX(_BINARY'\\<5C>\t'),HEX(_BINARY'\\<5C>\t\t');
SELECT HEX(_BINARY'''<EFBFBD>\'),HEX(_BINARY'<EFBFBD>\''');
SELECT HEX(_BINARY'\\''<EFBFBD>\'),HEX(_BINARY'<EFBFBD>\''\\');
CREATE TABLE t1 AS SELECT REPEAT(' ',10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES ('<EFBFBD>\'),('<EFBFBD>\t');
INSERT INTO t1 VALUES ('\\<5C>\'),('\\<5C>\t'),('\\<5C>\t\t');
INSERT INTO t1 VALUES ('''<EFBFBD>\'),('<EFBFBD>\''');
INSERT INTO t1 VALUES ('\\''<EFBFBD>\'),('<EFBFBD>\''\\');
SELECT a, HEX(a) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a BLOB);
INSERT INTO t1 VALUES ('<EFBFBD>\'),('<EFBFBD>\t');
INSERT INTO t1 VALUES ('\\<5C>\'),('\\<5C>\t'),('\\<5C>\t\t');
INSERT INTO t1 VALUES ('''<EFBFBD>\'),('<EFBFBD>\''');
INSERT INTO t1 VALUES ('\\''<EFBFBD>\'),('<EFBFBD>\''\\');
SELECT a, HEX(a) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES (BINARY('<EFBFBD>\')),(BINARY('<EFBFBD>\t'));
INSERT INTO t1 VALUES (BINARY('\\<5C>\')),(BINARY('\\<5C>\t')),(BINARY('\\<5C>\t\t'));
INSERT INTO t1 VALUES (BINARY('''<EFBFBD>\')),(BINARY('<EFBFBD>\'''));
INSERT INTO t1 VALUES (BINARY('\\''<EFBFBD>\')),(BINARY('<EFBFBD>\''\\'));
SELECT a, HEX(a) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a BLOB);
INSERT INTO t1 VALUES (BINARY('<EFBFBD>\')),(BINARY('<EFBFBD>\t'));
INSERT INTO t1 VALUES (BINARY('\\<5C>\')),(BINARY('\\<5C>\t')),(BINARY('\\<5C>\t\t'));
INSERT INTO t1 VALUES (BINARY('''<EFBFBD>\')),(BINARY('<EFBFBD>\'''));
INSERT INTO t1 VALUES (BINARY('\\''<EFBFBD>\')),(BINARY('<EFBFBD>\''\\'));
SELECT a, HEX(a) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES (_BINARY'<EFBFBD>\'),(_BINARY'<EFBFBD>\t');
INSERT INTO t1 VALUES (_BINARY'\\<5C>\'),(_BINARY'\\<5C>\t'),(_BINARY'\\<5C>\t\t');
INSERT INTO t1 VALUES (_BINARY'''<EFBFBD>\'),(_BINARY'<EFBFBD>\''');
INSERT INTO t1 VALUES (_BINARY'\\''<EFBFBD>\'),(_BINARY'<EFBFBD>\''\\');
SELECT a, HEX(a) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a BLOB);
INSERT INTO t1 VALUES (_BINARY'<EFBFBD>\'),(_BINARY'<EFBFBD>\t');
INSERT INTO t1 VALUES (_BINARY'\\<5C>\'),(_BINARY'\\<5C>\t'),(_BINARY'\\<5C>\t\t');
INSERT INTO t1 VALUES (_BINARY'''<EFBFBD>\'),(_BINARY'<EFBFBD>\''');
INSERT INTO t1 VALUES (_BINARY'\\''<EFBFBD>\'),(_BINARY'<EFBFBD>\''\\');
SELECT a, HEX(a) FROM t1;
DROP TABLE t1;
# Checking that with character_set_client=binary 0x5C in 0xE05C
# is treated as escape rather than the second byte of a multi-byte character,
# even if character_set_connection is big5/cp932/gbk/sjis.
# Note, the other 0x5C which is before 0xE05C is also treated as escape.
#
SET character_set_client=binary, character_set_results=binary;
SELECT @@character_set_client, @@character_set_connection, @@character_set_results;
SELECT HEX('<EFBFBD>\['), HEX('\<5C>\[');
CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES ('<EFBFBD>\['),('\<5C>\[');
SELECT HEX(a) FROM t1;
DROP TABLE t1;
#
# Checking the other way around:
# 0x5C in 0xE05C is treated as the second byte
# when character_set_client=big5,cp932,gbk,sjis
# and character_set_connection=binary
#
SET character_set_client=@@character_set_connection, character_set_results=@@character_set_connection;
SET character_set_connection=binary;
SELECT @@character_set_client, @@character_set_connection, @@character_set_results;
SELECT HEX('<EFBFBD>\['), HEX('\<5C>\[');
CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0;
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES ('<EFBFBD>\['),('\<5C>\[');
SELECT HEX(a) FROM t1;
DROP TABLE t1;
--echo # Start of ctype_E05C.inc

View File

@ -0,0 +1,327 @@
--echo # Start of ctype_unescape.inc
#
# Testing how string literals with backslash and quote-quote are unescaped.
# The tests assume that single quote (') is used as a delimiter.
#
#
# Make sure that the parser really works using the character set we need.
# We use binary strings to compose strings, to be able to test get malformed
# sequences, which are possible as a result of mysql_real_escape_string().
# The important thing for this test is to make the parser unescape using
# the client character set, rather than binary. Currently it works exactly
# that way by default, so the query below should return @@character_set_client
#
SET @query=_binary'SELECT CHARSET(\'test\'),@@character_set_client,@@character_set_connection';
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
let $CHARSET=`SELECT @@character_set_connection`;
CREATE TABLE allbytes (a VARBINARY(10));
#
# Create various byte sequences to test. Testing the full banch of
# possible combinations takes about 2 minutes. So this test provides
# variants to run with:
# - the full set of possible combinations
# - a reduced test of combinations for selected bytes only
#
# Create selected byte combinations
if ($ctype_unescape_combinations == 'selected')
{
--echo # Using selected bytes combinations
--source include/bytes.inc
#
# Populate "selected_bytes" with bytes that have a special meaning.
# We'll use "selected_bytes" to generate byte seqeunces,
# instead of the full possible byte combinations, to reduce test time.
#
CREATE TABLE selected_bytes (a VARBINARY(10));
# Bytes that have a special meaning in all character sets:
# 0x00 - mysql_real_escape_string() quotes this to '\0'
# 0x0D - mysql_real_escape_string() quotes this to '\r'
# 0x0A - mysql_real_escape_string() quotes this to '\n'
# 0x1A - mysql_real_escape_string() quotes this to '\Z'
# 0x08 - mysql_real_escape_string() does not quote this,
# but '\b' is unescaped to 0x08.
# 0x09 - mysql_real_escape_string() does not quote this,
# but '\t' is unescaped to 0x09.
# 0x30 - '0', as in '\0'
# 0x5A - 'Z', as in '\Z'
# 0x62 - 'b', as in '\b'
# 0x6E - 'n', as in '\n'
# 0x72 - 't', as in '\r'
# 0x74 - 't', as in '\t'
INSERT INTO selected_bytes (a) VALUES ('\0'),('\b'),('\t'),('\r'),('\n'),('\Z');
INSERT INTO selected_bytes (a) VALUES ('0'),('b'),('t'),('r'),('n'),('Z');
# 0x22 - double quote
# 0x25 - percent sign, '\%' is preserved as is for LIKE.
# 0x27 - single quote
# 0x5C - backslash
# 0x5F - underscore, '\_' is preserved as is for LIKE.
INSERT INTO selected_bytes (a) VALUES ('\\'),('_'),('%'),(0x22),(0x27);
# Some bytes do not have any special meaning, for example basic Latin letters.
# Let's add, one should be enough for a good enough coverage.
INSERT INTO selected_bytes (a) VALUES ('a');
#
# This maps summarizes bytes that have a special
# meaning in various character sets:
#
# MBHEAD MBTAIL NONASCII-8BIT BAD
# ------ ------ -------------- ----------
# big5: [A1..F9] [40..7E,A1..FE] N/A [80..A0,FA..FF]
# cp932: [81..9F,E0..FC] [40..7E,80..FC] [A1..DF] [FD..FF]
# gbk: [81..FE] [40..7E,80..FE] N/A [FF]
# sjis: [81..9F,E0..FC] [40..7E,80..FC] [A1..DF] [FD..FF]
# swe7: N/A N/A [5B..5E,7B..7E] [80..FF]
#
INSERT INTO selected_bytes (a) VALUES
(0x3F), # 7bit
(0x40), # 7bit mbtail
(0x7E), # 7bit mbtail nonascii-8bit
(0x7F), # 7bit nonascii-8bit
(0x80), # mbtail bad-mb
(0x81), # mbhead mbtail
(0x9F), # mbhead mbtail bad-mb
(0xA0), # mbhead mbtail bad-mb
(0xA1), # mbhead mbtail nonascii-8bit
(0xE0), # mbhead mbtai
(0xEF), # mbhead mbtail
(0xF9), # mbhead mbtail
(0xFA), # mbhead mbtail bad-mb
(0xFC), # mbhead mbtail bad-mb
(0xFD), # mbhead mbtail bad-mb
(0xFE), # mbhead mbtial bad-mb
(0xFF); # bad-mb
#
# Now populate the test table
#
# Use all single bytes, this is cheap, there are only 256 values.
INSERT INTO allbytes (a) SELECT a FROM bytes;
# Add selected bytes combinations
INSERT INTO allbytes (a) SELECT CONCAT(t1.a,t2.a) FROM selected_bytes t1,selected_bytes t2;
INSERT INTO allbytes (a) SELECT CONCAT(0x5C,t1.a,t2.a) FROM selected_bytes t1,selected_bytes t2;
INSERT INTO allbytes (a) SELECT CONCAT(0x5C,t1.a,0x5C,t2.a) FROM selected_bytes t1,selected_bytes t2;
DROP TABLE selected_bytes;
# Delete all non-single byte sequences that do not have
# backslashes or quotes at all. There is nothing special with these strings.
DELETE FROM allbytes WHERE
OCTET_LENGTH(a)>1 AND
LOCATE(0x5C,a)=0 AND
a NOT LIKE '%\'%' AND
a NOT LIKE '%"%';
}
if ($ctype_unescape_combinations=='')
{
--echo # Using full byte combinations
--source include/bytes2.inc
INSERT INTO allbytes (a) SELECT a FROM bytes;
INSERT INTO allbytes (a) SELECT CONCAT(hi,lo) FROM bytes2;
INSERT INTO allbytes (a) SELECT CONCAT(0x5C,hi,lo) FROM bytes2;
INSERT INTO allbytes (a) SELECT CONCAT(0x5C,hi,0x5C,lo) FROM bytes2;
}
DELIMITER //;
#
# A procedure that make an SQL query using 'val' as a string literal.
# The result of the query execution is written into the table 't1'.
# NULL in t1.b means that query failed due to syntax error,
# typically because of mis-interpreted closing quote delimiter.
#
CREATE PROCEDURE p1(val VARBINARY(10))
BEGIN
DECLARE EXIT HANDLER FOR SQLSTATE '42000' INSERT INTO t1 (a,b) VALUES(val,NULL);
SET @query=CONCAT(_binary"INSERT INTO t1 (a,b) VALUES (0x",HEX(val),",'",val,"')");
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END//
#
# A procedure that iterates through all records in "allbytes".
# And runs p1() for every record.
#
CREATE PROCEDURE p2()
BEGIN
DECLARE val VARBINARY(10);
DECLARE done INT DEFAULT FALSE;
DECLARE stmt CURSOR FOR SELECT a FROM allbytes;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done=TRUE;
OPEN stmt;
read_loop1: LOOP
FETCH stmt INTO val;
IF done THEN
LEAVE read_loop1;
END IF;
CALL p1(val);
END LOOP;
CLOSE stmt;
END//
# A function that converts the value from binary to $CHARSET
# and check if it has changed. CONVERT() fixes malformed strings.
# So if the string changes in CONVERT(), it means it was not wellformed.
--eval CREATE FUNCTION iswellformed(a VARBINARY(256)) RETURNS INT RETURN a=BINARY CONVERT(a USING $CHARSET);
#
# A function that approximately reproduces how the SQL parser
# would unescape a binary string.
#
CREATE FUNCTION unescape(a VARBINARY(256)) RETURNS VARBINARY(256)
BEGIN
# We need to do it in a way to avoid producing new escape sequences
# First, enclose all known escsape sequences to '{{xx}}'
# - Backslash not followed by a LIKE pattern characters _ and %
# - Double escapes
# This uses PCRE Branch Reset Groups: (?|(alt1)|(alt2)|(alt3)).
# So '\\1' in the last argument always means the match, no matter
# which alternative it came from.
SET a=REGEXP_REPLACE(a,'(?|(\\\\[^_%])|(\\x{27}\\x{27}))','{{\\1}}');
# Now unescape all enclosed standard escape sequences
SET a=REPLACE(a,'{{\\0}}', '\0');
SET a=REPLACE(a,'{{\\b}}', '\b');
SET a=REPLACE(a,'{{\\t}}', '\t');
SET a=REPLACE(a,'{{\\r}}', '\r');
SET a=REPLACE(a,'{{\\n}}', '\n');
SET a=REPLACE(a,'{{\\Z}}', '\Z');
SET a=REPLACE(a,'{{\\\'}}', '\'');
# Unescape double quotes
SET a=REPLACE(a,'{{\'\'}}', '\'');
# Unescape the rest: all other \x sequences mean just 'x'
SET a=REGEXP_REPLACE(a, '{{\\\\(.|\\R)}}', '\\1');
RETURN a;
END//
#
# A function that checks what happened during unescaping.
#
# @param a - the value before unescaping
# @param b - the value after unescaping
#
# The following return values are possible:
# - SyntErr - b IS NULL, which means syntax error happened in p1().
# - Preserv - the value was not modified during unescaping.
# This is possible if 0x5C was treated as mbtail.
# Or only LIKE escape sequences were found: '\_' and '\%'.
# - Trivial - only 0x5C were removed.
# - Regular - the value was unescaped like a binary string.
# Some standard escape sequences were found.
# No special multi-byte handling happened.
# - Special - Something else happened. Should not happen.
#
CREATE FUNCTION unescape_type(a VARBINARY(256),b VARBINARY(256)) RETURNS VARBINARY(256)
BEGIN
RETURN CASE
WHEN b IS NULL THEN '[SyntErr]'
WHEN a=b THEN CASE
WHEN OCTET_LENGTH(a)=1 THEN '[Preserve]'
WHEN a RLIKE '\\\\[_%]' THEN '[Preserve][LIKE]'
WHEN a RLIKE '^[[:ascii:]]+$' THEN '[Preserve][ASCII]'
ELSE '[Preserv][MB]' END
WHEN REPLACE(a,0x5C,'')=b THEN '[Trivial]'
WHEN UNESCAPE(a)=b THEN '[Regular]'
ELSE '[Special]' END;
END//
#
# Check what happened with wellformedness during unescaping
# @param a - the value before unescaping
# @param b - the value after unescaping
#
# Returned values:
# [FIXED] - the value was malformed and become wellformed after unescaping
# [BROKE] - the value was wellformed and become malformed after unescaping
# [ILSEQ] - both values (before unescaping and after unescaping) are malformed
# '' - both values are wellformed
#
CREATE FUNCTION wellformedness(a VARBINARY(256), b VARBINARY(256))
RETURNS VARBINARY(256)
BEGIN
RETURN CASE
WHEN b IS NULL THEN ''
WHEN NOT iswellformed(a) AND iswellformed(b) THEN '[FIXED]'
WHEN iswellformed(a) AND NOT iswellformed(b) THEN '[BROKE]'
WHEN NOT iswellformed(a) AND NOT iswellformed(b) THEN '[ILSEQ]'
ELSE ''
END;
END//
#
# Check if the value could be generated by mysql_real_escape_string(),
# or can only come from a direct user input.
#
# @param a - the value before unescaping
#
# Returns:
# [USER] - if the value could not be generated by mysql_real_escape_string()
# '' - if the value was possibly generated by mysql_real_escape_string()
#
#
CREATE FUNCTION mysql_real_escape_string_generated(a VARBINARY(256))
RETURNS VARBINARY(256)
BEGIN
DECLARE a1 BINARY(1) DEFAULT SUBSTR(a,1,1);
DECLARE a2 BINARY(1) DEFAULT SUBSTR(a,2,1);
DECLARE a3 BINARY(1) DEFAULT SUBSTR(a,3,1);
DECLARE a4 BINARY(1) DEFAULT SUBSTR(a,4,1);
DECLARE a2a4 BINARY(2) DEFAULT CONCAT(a2,a4);
RETURN CASE
WHEN (a1=0x5C) AND
(a3=0x5C) AND
(a2>0x7F) AND
(a4 NOT IN ('_','%','0','t','r','n','Z')) AND
iswellformed(a2a4) THEN '[USER]'
ELSE ''
END;
END//
DELIMITER ;//
CREATE TABLE t1 (a VARBINARY(10),b VARBINARY(10));
CALL p2();
# Avoid "Invalid XXX character string" warnings
# We mark malformed strings in the output anyway
--disable_warnings
# All records marked with '[BAD]' mean that the string was unescaped
# in a unexpected way, that means there is a bug in UNESCAPE() above.
SELECT HEX(a),HEX(b),
CONCAT(unescape_type(a,b),
wellformedness(a,b),
mysql_real_escape_string_generated(a),
IF(UNESCAPE(a)<>b,CONCAT('[BAD',HEX(UNESCAPE(a)),']'),'')) AS comment
FROM t1 ORDER BY LENGTH(a),a;
--enable_warnings
DROP TABLE t1;
DROP PROCEDURE p1;
DROP PROCEDURE p2;
DROP FUNCTION unescape;
DROP FUNCTION unescape_type;
DROP FUNCTION wellformedness;
DROP FUNCTION mysql_real_escape_string_generated;
DROP FUNCTION iswellformed;
DROP TABLE allbytes;
--echo # End of ctype_backslash.inc

View File

@ -0,0 +1,161 @@
#
# This is a shared file included from t/gis-precise.test and t/gis-debug.test
#
# - gis-precise.test is executed both in debug and production builds
# and makes sure that the checked GIS functions return the expected results.
#
# - gis-debug.test is executed only in debug builds
# (and is skipped in production builds).
# gis-debug.test activates tracing of the internal GIS routines.
# The trace log is printed to the client side warnings.
# So gis-debug.test makes sure not only that the correct results are returned,
# but also check *how* these results were generated - makes sure that
# the internal GIS routines went through the expected data and code flow paths.
#
--disable_warnings
DROP TABLE IF EXISTS p1;
--enable_warnings
DELIMITER |;
CREATE PROCEDURE p1(dist DOUBLE, geom TEXT)
BEGIN
DECLARE g GEOMETRY;
SET g=GeomFromText(geom);
SELECT geom AS `-----`;
SELECT dist, GeometryType(@buf:=ST_Buffer(g, dist)) AS `buffer`, ROUND(ST_AREA(@buf),2) AS buf_area;
END|
DELIMITER ;|
--disable_query_log
--echo #
--echo # Testing ST_BUFFER with positive distance
--echo #
CALL p1(1, 'POINT(0 0))');
CALL p1(1, 'LineString(0 1, 1 1))');
CALL p1(1, 'LineString(9 9,8 1,1 5,0 0)');
CALL p1(1, 'Polygon((2 2,2 8,8 8,8 2,2 2))');
CALL p1(1, 'Polygon((0 0,0 8,8 8,8 0,0 0),(2 2,6 2,6 6,2 6,2 2))');
CALL p1(1, 'Polygon((0 0, 0 8, 8 8, 8 10, -10 10, -10 0, 0 0))');
CALL p1(1, 'MultiPoint(9 9,8 1,1 5)');
CALL p1(1, 'MultiLineString((0 0,2 2))');
CALL p1(1, 'MultiLineString((0 0,2 2,0 4))');
CALL p1(1, 'MultiLineString((0 0,2 2),(0 2,2 0))');
CALL p1(1, 'MultiLineString((2 2,2 8,-2 8),(-6 -6, 6 6),(10 10, 14 14))');
CALL p1(1, 'MultiPolygon(((2 2,2 8,8 8,8 2,2 2)), ((9 9,8 1,1 5,9 9)))');
CALL p1(1, 'MultiPolygon(((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)),((9 9,8 1,1 5,9 9)))');
CALL p1(1, 'GeometryCollection(Point(0 0))');
CALL p1(1, 'GeometryCollection(LineString(0 0, 2 2)))');
CALL p1(1, 'GeometryCollection(Polygon((2 2,2 8,8 8,8 2,2 2))))');
CALL p1(1, 'GeometryCollection(MultiPoint(9 9,8 1,1 5))');
CALL p1(1, 'GeometryCollection(MultiLineString((0 0,0 1),(3 0,3 1)))');
CALL p1(1, 'GeometryCollection(MultiPolygon(((0 0, 3 0, 3 3, 0 3, 0 0)),((6 6,6 9,9 9,9 6,6 6))))');
CALL p1(1, 'GeometryCollection(Point(9 9),LineString(1 5,0 0),Polygon((2 2,2 8,8 8,8 2,2 2)))');
--echo #
--echo # Testing ST_BUFFER with zero distance
--echo #
CALL p1(0, 'POINT(0 0))');
CALL p1(0, 'LineString(0 1, 1 1))');
CALL p1(0, 'LineString(9 9,8 1,1 5,0 0)');
CALL p1(0, 'Polygon((2 2,2 8,8 8,8 2,2 2))');
CALL p1(0, 'Polygon((0 0,0 8,8 8,8 0,0 0),(2 2,6 2,6 6,2 6,2 2))');
CALL p1(0, 'Polygon((0 0, 0 8, 8 8, 8 10, -10 10, -10 0, 0 0))');
CALL p1(0, 'MultiPoint(9 9,8 1,1 5)');
CALL p1(0, 'MultiLineString((0 0,2 2))');
CALL p1(0, 'MultiLineString((0 0,2 2,0 4))');
CALL p1(0, 'MultiLineString((0 0,2 2),(0 2,2 0))');
CALL p1(0, 'MultiLineString((2 2,2 8,-2 8),(-6 -6, 6 6),(10 10, 14 14))');
CALL p1(0, 'MultiPolygon(((2 2,2 8,8 8,8 2,2 2)), ((9 9,8 1,1 5,9 9)))');
CALL p1(0, 'MultiPolygon(((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)),((9 9,8 1,1 5,9 9)))');
CALL p1(0, 'GeometryCollection(Point(0 0))');
CALL p1(0, 'GeometryCollection(LineString(0 0, 2 2)))');
CALL p1(0, 'GeometryCollection(Polygon((2 2,2 8,8 8,8 2,2 2))))');
CALL p1(0, 'GeometryCollection(MultiPoint(9 9,8 1,1 5))');
CALL p1(0, 'GeometryCollection(MultiLineString((0 0,0 1),(3 0,3 1)))');
CALL p1(0, 'GeometryCollection(MultiPolygon(((0 0, 3 0, 3 3, 0 3, 0 0)),((6 6,6 9,9 9,9 6,6 6))))');
CALL p1(0, 'GeometryCollection(Point(9 9),LineString(1 5,0 0),Polygon((2 2,2 8,8 8,8 2,2 2)))');
--echo #
--echo # Testing ST_BUFFER with negative distance
--echo #
CALL p1(-1, 'POINT(0 0))');
CALL p1(-1, 'LineString(0 1, 1 1))');
CALL p1(-1, 'LineString(9 9,8 1,1 5,0 0)');
CALL p1(-1, 'Polygon((2 2,2 8,8 8,8 2,2 2))');
#
# Wrong shape
# CALL p1(-1, 'Polygon((0 0,0 8,8 8,8 0,0 0),(2 2,6 2,6 6,2 6,2 2))');
# Wrong shape
# CALL p1(-1, 'Polygon((0 0, 0 8, 8 8, 8 10, -10 10, -10 0, 0 0))');
#
CALL p1(-1, 'MultiPoint(9 9,8 1,1 5)');
CALL p1(-1, 'MultiLineString((0 0,2 2))');
CALL p1(-1, 'MultiLineString((0 0,2 2,0 4))');
CALL p1(-1, 'MultiLineString((0 0,2 2),(0 2,2 0))');
CALL p1(-1, 'MultiLineString((2 2,2 8,-2 8),(-6 -6, 6 6),(10 10, 14 14))');
#
# Wrong shape
#CALL p1(-1, 'MultiPolygon(((2 2,2 8,8 8,8 2,2 2)), ((9 9,8 1,1 5,9 9)))');
#CALL p1(-1, 'MultiPolygon(((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)),((9 9,8 1,1 5,9 9)))');
#
CALL p1(-1, 'GeometryCollection(Point(0 0))');
CALL p1(-1, 'GeometryCollection(LineString(0 0, 2 2)))');
CALL p1(-1, 'GeometryCollection(Polygon((2 2,2 8,8 8,8 2,2 2))))');
CALL p1(-1, 'GeometryCollection(MultiPoint(9 9,8 1,1 5))');
CALL p1(-1, 'GeometryCollection(MultiLineString((0 0,0 1),(3 0,3 1)))');
#
# Wrong shape
# CALL p1(-1, 'GeometryCollection(MultiPolygon(((0 0, 3 0, 3 3, 0 3, 0 0)),((6 6,6 9,9 9,9 6,6 6))))');
#
CALL p1(-1, 'GeometryCollection(Point(9 9),LineString(1 5,0 0),Polygon((2 2,2 8,8 8,8 2,2 2)))');
--enable_query_log
SELECT ST_CONTAINS(
GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'),
GeomFromText('POINT(5 10)'));
SELECT AsText(ST_UNION(
GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'),
GeomFromText('POINT(5 10)')));
DROP PROCEDURE p1;
--echo #
--echo # Bug #13833019 ASSERTION `T1->RESULT_RANGE' FAILED IN GCALC_OPERATION_REDUCER::END_COUPLE
--echo #
SELECT GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((0 0,9 4,3 3,0 0)),((2 2,2 2,8 8,2 3,2 2)))'), 3));
--echo #
--echo # Bug #13832749 HANDLE_FATAL_SIGNAL IN GCALC_FUNCTION::COUNT_INTERNAL
--echo #
SELECT GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)), ((9 9,8 1,1 5,9 9)))'),1));
--echo #
--echo # Bug#13358363 - ASSERTION: N > 0 && N < SINUSES_CALCULATED*2+1 | GET_N_SINCOS/ADD_EDGE_BUFFER
--echo #
DO ST_BUFFER(ST_GEOMCOLLFROMTEXT('linestring(1 1,2 2)'),'');
SELECT ST_WITHIN(
LINESTRINGFROMTEXT(' LINESTRING(3 8,9 2,3 8,3 3,7 6,4 7,4 7,8 1) '),
ST_BUFFER(MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2),(4 4,4 6,6 6,6 4,4 4)),((0 5,3 5,3 2,1 2,1 1,3 1,3 0,0 0,0 3,2 3,2 4,0 4,0 5))) '),
ST_NUMINTERIORRINGS(POLYGONFROMTEXT('POLYGON((3 5,2 4,2 5,3 5)) '))));
SELECT ST_DIMENSION(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((3 5,2 5,2 4,3 4,3 5)) '),
ST_NUMINTERIORRINGS(POLYGONFROMTEXT(' POLYGON((0 0,9 3,4 2,0 0))'))));
SELECT ST_NUMINTERIORRINGS(
ST_ENVELOPE(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5))) '),
SRID(MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 2,4 2,1 2,2 4,2 2)) ')))));
SELECT ASTEXT(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((9 9,5 2,4 5,9 9))'),
SRID(GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) '))));

View File

@ -72,6 +72,19 @@ INSERT into gis_geometry SELECT * FROM gis_multi_line;
INSERT into gis_geometry SELECT * FROM gis_multi_polygon;
INSERT into gis_geometry SELECT * FROM gis_geometrycollection;
-- disable_query_log
-- disable_result_log
ANALYZE TABLE gis_point;
ANALYZE TABLE gis_line;
ANALYZE TABLE gis_polygon;
ANALYZE TABLE gis_multi_point;
ANALYZE TABLE gis_multi_line;
ANALYZE TABLE gis_multi_polygon;
ANALYZE TABLE gis_geometrycollection;
ANALYZE TABLE gis_geometry;
-- enable_result_log
-- enable_query_log
SELECT fid, AsText(g) FROM gis_point ORDER by fid;
SELECT fid, AsText(g) FROM gis_line ORDER by fid;
SELECT fid, AsText(g) FROM gis_polygon ORDER by fid;

View File

@ -1,4 +0,0 @@
--require r/have_mysql_upgrade.result
--disable_query_log
select LENGTH("$MYSQL_UPGRADE")>0 as have_mysql_upgrade;
--enable_query_log

View File

@ -0,0 +1,15 @@
#
# Check if server has support for loading plugins
#
if (`SELECT @@have_dynamic_loading != 'YES'`) {
--skip Requires dynamic loading
}
#
# Check if the variable SEMISYNC_MASTER_SO is set
#
if (!$SEMISYNC_MASTER_SO)
{
skip Need semisync plugins;
}

View File

@ -14,7 +14,7 @@
if ($value == No such row)
{
SET sql_log_bin = 0;
eval INSTALL PLUGIN rpl_semi_sync_master SONAME '$SEMISYNC_MASTER_PLUGIN';
install plugin rpl_semi_sync_master soname 'semisync_master';
SET GLOBAL rpl_semi_sync_master_enabled = 1;
SET sql_log_bin = 1;
}
@ -28,7 +28,7 @@ if ($value == No such row)
if ($value == No such row)
{
SET sql_log_bin = 0;
eval INSTALL PLUGIN rpl_semi_sync_slave SONAME '$SEMISYNC_SLAVE_PLUGIN';
install plugin rpl_semi_sync_slave soname 'semisync_slave';
SET GLOBAL rpl_semi_sync_slave_enabled = 1;
SET sql_log_bin = 1;
}

View File

@ -155,6 +155,7 @@ INSERT INTO global_suppressions VALUES
("InnoDB: Error: in ALTER TABLE `test`.`t[123]`"),
("InnoDB: Error: in RENAME TABLE table `test`.`t1`"),
("InnoDB: Error: table `test`.`t[123]` .*does not exist in the InnoDB internal"),
("InnoDB: Warning: semaphore wait:"),
/*
BUG#32080 - Excessive warnings on Solaris: setrlimit could not

View File

@ -2,13 +2,6 @@
# Can't run test of external client with embedded server
-- source include/not_embedded.inc
# Only run test if "mysql_upgrade" is found
--require r/have_mysql_upgrade.result
--disable_query_log
select LENGTH("$MYSQL_UPGRADE")>0 as have_mysql_upgrade;
--enable_query_log
#
# Hack:
#

View File

@ -109,7 +109,7 @@ DROP DATABASE hotcopy_save;
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--list_files $MYSQLD_DATADIR/hotcopy_save
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
--error 9,11,2304
--error 1
--exec $MYSQLHOTCOPY --quiet -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
--exec $MYSQLHOTCOPY --quiet --allowold -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save

View File

@ -10,6 +10,10 @@
# The environment variables SEARCH_FILE and SEARCH_PATTERN must be set
# before sourcing this routine.
#
# Optionally, SEARCH_RANGE can be set to the max number of bytes of the file
# to search. If negative, it will search that many bytes at the end of the
# file. The default is to search only the first 50000 bytes of the file.
#
# In case of
# - SEARCH_FILE and/or SEARCH_PATTERN is not set
# - SEARCH_FILE cannot be opened
@ -38,6 +42,7 @@
# --error 0,1
# --remove_file $error_log
# let SEARCH_FILE= $error_log;
# let SEARCH_RANGE= -50000;
# # Stop the server
# let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
# --exec echo "wait" > $restart_file
@ -57,8 +62,18 @@ perl;
use strict;
my $search_file= $ENV{'SEARCH_FILE'} or die "SEARCH_FILE not set";
my $search_pattern= $ENV{'SEARCH_PATTERN'} or die "SEARCH_PATTERN not set";
my $search_range= $ENV{'SEARCH_RANGE'};
my $file_content;
$search_range= 50000 unless $search_range =~ /-?[0-9]+/;
open(FILE, "$search_file") or die("Unable to open '$search_file': $!\n");
read(FILE, my $file_content, 50000, 0);
if ($search_range >= 0) {
read(FILE, $file_content, $search_range, 0);
} else {
my $size= -s $search_file;
$search_range = -$size if $size > -$search_range;
seek(FILE, $search_range, 2);
read(FILE, $file_content, -$search_range, 0);
}
close(FILE);
if ( not $file_content =~ m{$search_pattern} ) {
die("# ERROR: The file '$search_file' does not contain the expected pattern $search_pattern\n->$file_content<-\n");

View File

@ -83,7 +83,7 @@ let $script=
s{block_len=[0-9]+}{block_len=#};
s{Server ver:.*DOLLAR}{SERVER_VERSION, BINLOG_VERSION};
s{GTID [0-9]+-[0-9]+-[0-9]+}{GTID #-#-#};
s{\[[0-9]-[0-9]-[0-9]+\]}{[#-#-#]};
s{\[([0-9]-[0-9]-[0-9]+,?)+\]}{[#-#-#]};
s{cid=[0-9]+}{cid=#};
s{SQL_LOAD-[a-z,0-9,-]*.[a-z]*}{SQL_LOAD-<SERVER UUID>-<MASTER server-id>-<file-id>.<extension>};
s{rand_seed1=[0-9]*,rand_seed2=[0-9]*}{rand_seed1=<seed 1>,rand_seed2=<seed 2>};

View File

@ -0,0 +1,32 @@
# ==== Purpose ====
#
# Stop all dump threads on the server of the current connection.
#
# ==== Usage ====
#
# --source include/stop_dump_threads.inc
--let $include_filename= stop_dump_threads.inc
--source include/begin_include_file.inc
--let $_sdt_show_rpl_debug_info_old= $show_rpl_debug_info
--let $show_rpl_debug_info= 1
--disable_query_log
--disable_result_log
--let $_sdt_dump_thread_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND = 'Binlog dump'`
while ($_sdt_dump_thread_id != '')
{
eval KILL $_sdt_dump_thread_id;
--let $wait_condition= SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE ID = $_sdt_dump_thread_id
--source include/wait_condition.inc
--let $_sdt_dump_thread_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND = 'Binlog dump'`
}
--let $show_rpl_debug_info= $_sdt_show_rpl_debug_info_old
--let $include_filename= stop_dump_threads.inc
--source include/end_include_file.inc

View File

@ -13,6 +13,11 @@
UNINSTALL PLUGIN rpl_semi_sync_slave;
--connection master
# After BUG#17638477 fix, uninstallation of rpl_semi_sync_master
# is not allowed when there are semi sync slaves. Hence kill
# all dump threads before uninstalling it.
SET GLOBAL rpl_semi_sync_master_enabled = OFF;
--source include/stop_dump_threads.inc
UNINSTALL PLUGIN rpl_semi_sync_master;
--enable_warnings