1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00
This commit is contained in:
Georgi Kodinov
2010-09-29 17:26:32 +03:00
35 changed files with 442 additions and 104 deletions

View File

@@ -1,4 +1,4 @@
[MYSQL] [MYSQL]
post_commit_to = "commits@lists.mysql.com" post_commit_to = "commits@lists.mysql.com"
post_push_to = "commits@lists.mysql.com" post_push_to = "commits@lists.mysql.com"
tree_name = "mysql-5.5-bugfixing" tree_name = "mysql-5.5-bugteam"

View File

@@ -92,3 +92,6 @@ parts.partition_mgm_lc1_ndb # joro : NDB tests marked as experiment
parts.partition_mgm_lc2_ndb # joro : NDB tests marked as experimental as agreed with bochklin parts.partition_mgm_lc2_ndb # joro : NDB tests marked as experimental as agreed with bochklin
parts.partition_syntax_ndb # joro : NDB tests marked as experimental as agreed with bochklin parts.partition_syntax_ndb # joro : NDB tests marked as experimental as agreed with bochklin
parts.partition_value_ndb # joro : NDB tests marked as experimental as agreed with bochklin parts.partition_value_ndb # joro : NDB tests marked as experimental as agreed with bochklin
main.gis-rtree # svoj: due to BUG#38965
main.type_float # svoj: due to BUG#38965
main.type_newdecimal # svoj: due to BUG#38965

View File

@@ -360,4 +360,19 @@ SELECT COALESCE(a) = COALESCE(b) FROM t1;
COALESCE(a) = COALESCE(b) COALESCE(a) = COALESCE(b)
1 1
DROP TABLE t1; DROP TABLE t1;
End of tests #
# Bug #54461: crash with longblob and union or update with subquery
#
CREATE TABLE t1 (a INT, b LONGBLOB);
INSERT INTO t1 VALUES (1, '2'), (2, '3'), (3, '2');
SELECT DISTINCT LEAST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1;
LEAST(a, (SELECT b FROM t1 LIMIT 1))
1
2
SELECT DISTINCT GREATEST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1;
GREATEST(a, (SELECT b FROM t1 LIMIT 1))
2
3
1
DROP TABLE t1;
End of 5.1 tests

View File

@@ -707,10 +707,7 @@ numgeometries(b) IS NULL, numinteriorrings(b) IS NULL, numpoints(b) IS NULL,
area(b) IS NULL, glength(b) IS NULL, srid(b) IS NULL, x(b) IS NULL, area(b) IS NULL, glength(b) IS NULL, srid(b) IS NULL, x(b) IS NULL,
y(b) IS NULL y(b) IS NULL
from t1; from t1;
geometryfromtext(b) IS NULL geometryfromwkb(b) IS NULL astext(b) IS NULL aswkb(b) IS NULL geometrytype(b) IS NULL centroid(b) IS NULL envelope(b) IS NULL startpoint(b) IS NULL endpoint(b) IS NULL exteriorring(b) IS NULL pointn(b, 1) IS NULL geometryn(b, 1) IS NULL interiorringn(b, 1) IS NULL multipoint(b) IS NULL isempty(b) IS NULL issimple(b) IS NULL isclosed(b) IS NULL dimension(b) IS NULL numgeometries(b) IS NULL numinteriorrings(b) IS NULL numpoints(b) IS NULL area(b) IS NULL glength(b) IS NULL srid(b) IS NULL x(b) IS NULL y(b) IS NULL ERROR 22007: Illegal non geometric '`test`.`t1`.`b`' value found during parsing
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
select select
within(b, b) IS NULL, contains(b, b) IS NULL, overlaps(b, b) IS NULL, within(b, b) IS NULL, contains(b, b) IS NULL, overlaps(b, b) IS NULL,
equals(b, b) IS NULL, disjoint(b, b) IS NULL, touches(b, b) IS NULL, equals(b, b) IS NULL, disjoint(b, b) IS NULL, touches(b, b) IS NULL,
@@ -725,10 +722,7 @@ point(b, b) IS NULL, linestring(b) IS NULL, polygon(b) IS NULL, multipoint(b) IS
multilinestring(b) IS NULL, multipolygon(b) IS NULL, multilinestring(b) IS NULL, multipolygon(b) IS NULL,
geometrycollection(b) IS NULL geometrycollection(b) IS NULL
from t1; from t1;
point(b, b) IS NULL linestring(b) IS NULL polygon(b) IS NULL multipoint(b) IS NULL multilinestring(b) IS NULL multipolygon(b) IS NULL geometrycollection(b) IS NULL ERROR 22007: Illegal non geometric '`test`.`t1`.`b`' value found during parsing
0 1 1 1 1 1 1
1 1 1 1 1 1 1
0 1 1 1 1 1 1
drop table t1; drop table t1;
CREATE TABLE t1(a POINT) ENGINE=MyISAM; CREATE TABLE t1(a POINT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (NULL); INSERT INTO t1 VALUES (NULL);
@@ -1010,53 +1004,9 @@ f5 datetime YES NULL
drop view v1; drop view v1;
drop table t1; drop table t1;
SELECT MultiPoint(12345,''); SELECT MultiPoint(12345,'');
MultiPoint(12345,'') ERROR 22007: Illegal non geometric '12345' value found during parsing
NULL SELECT 1 FROM (SELECT GREATEST(1,GEOMETRYCOLLECTION('00000','00000')) b FROM DUAL) AS d WHERE (LINESTRING(d.b));
SELECT MultiPoint(123451,''); ERROR 22007: Illegal non geometric ''00000'' value found during parsing
MultiPoint(123451,'')
NULL
SELECT MultiPoint(1234512,'');
MultiPoint(1234512,'')
NULL
SELECT MultiPoint(12345123,'');
MultiPoint(12345123,'')
NULL
SELECT MultiLineString(12345,'');
MultiLineString(12345,'')
NULL
SELECT MultiLineString(123451,'');
MultiLineString(123451,'')
NULL
SELECT MultiLineString(1234512,'');
MultiLineString(1234512,'')
NULL
SELECT MultiLineString(12345123,'');
MultiLineString(12345123,'')
NULL
SELECT LineString(12345,'');
LineString(12345,'')
NULL
SELECT LineString(123451,'');
LineString(123451,'')
NULL
SELECT LineString(1234512,'');
LineString(1234512,'')
NULL
SELECT LineString(12345123,'');
LineString(12345123,'')
NULL
SELECT Polygon(12345,'');
Polygon(12345,'')
NULL
SELECT Polygon(123451,'');
Polygon(123451,'')
NULL
SELECT Polygon(1234512,'');
Polygon(1234512,'')
NULL
SELECT Polygon(12345123,'');
Polygon(12345123,'')
NULL
# #
# BUG#51875: crash when loading data into geometry function polyfromwkb # BUG#51875: crash when loading data into geometry function polyfromwkb
# #

View File

@@ -1185,4 +1185,40 @@ NULL
NULL NULL
1 1
DROP TABLE t1, t2, mm1; DROP TABLE t1, t2, mm1;
#
# Bug #54468: crash after item's print() function when ordering/grouping
# by subquery
#
CREATE TABLE t1(a INT, b INT);
INSERT INTO t1 VALUES (), ();
SELECT 1 FROM t1
GROUP BY
GREATEST(t1.a,
(SELECT 1 FROM
(SELECT t1.b FROM t1,t1 t2
ORDER BY t1.a, t1.a LIMIT 1) AS d)
);
1
1
DROP TABLE t1;
#
# Bug #53544: Server hangs during JOIN query in stored procedure called
# twice in a row
#
CREATE TABLE t1(c INT);
INSERT INTO t1 VALUES (1), (2);
PREPARE stmt FROM "SELECT t2.c AS f1 FROM t1 LEFT JOIN
t1 t2 ON t1.c=t2.c RIGHT JOIN
t1 t3 ON t1.c=t3.c
GROUP BY f1;";
EXECUTE stmt;
f1
1
2
EXECUTE stmt;
f1
1
2
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
End of 5.1 tests End of 5.1 tests

View File

@@ -296,4 +296,16 @@ CONVERT_TZ(NOW(), 'UTC', 'Europe/Moscow') IS NULL
UPDATE t1 SET t = CONVERT_TZ(t, 'UTC', 'Europe/Moscow'); UPDATE t1 SET t = CONVERT_TZ(t, 'UTC', 'Europe/Moscow');
UNLOCK TABLES; UNLOCK TABLES;
DROP TABLE t1; DROP TABLE t1;
#
# Bug #55424: convert_tz crashes when fed invalid data
#
CREATE TABLE t1 (a SET('x') NOT NULL);
INSERT INTO t1 VALUES ('');
SELECT CONVERT_TZ(1, a, 1) FROM t1;
CONVERT_TZ(1, a, 1)
NULL
SELECT CONVERT_TZ(1, 1, a) FROM t1;
CONVERT_TZ(1, 1, a)
NULL
DROP TABLE t1;
End of 5.1 tests End of 5.1 tests

View File

@@ -428,6 +428,23 @@ CREATE TRIGGER t_after_insert AFTER INSERT ON t1 FOR EACH ROW SET @bug42188 = 10
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (0),(0);
# BUG#55615 : should not crash
SELECT (@a:=(SELECT @a:=1 FROM t1 LIMIT 1)) AND COUNT(1) FROM t1 GROUP BY @a;
(@a:=(SELECT @a:=1 FROM t1 LIMIT 1)) AND COUNT(1)
1
1
# BUG#55564 : should not crash
SELECT IF(
@v:=LEAST((SELECT 1 FROM t1 t2 LEFT JOIN t1 ON (@v) GROUP BY t1.a), a),
count(*), 1)
FROM t1 GROUP BY a LIMIT 1;
IF(
@v:=LEAST((SELECT 1 FROM t1 t2 LEFT JOIN t1 ON (@v) GROUP BY t1.a), a),
count(*), 1)
1
DROP TABLE t1;
End of 5.1 tests End of 5.1 tests
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
CREATE TABLE t1(f1 INT AUTO_INCREMENT, PRIMARY KEY(f1)); CREATE TABLE t1(f1 INT AUTO_INCREMENT, PRIMARY KEY(f1));

View File

@@ -1244,3 +1244,16 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`c1`) PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
DROP TABLE t1; DROP TABLE t1;
DROP TABLE IF EXISTS t1;
Warnings:
Note 1051 Unknown table 't1'
CREATE TABLE t1(c1 BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (NULL);
INSERT INTO t1 VALUES (18446744073709551615);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=18446744073709551615 DEFAULT CHARSET=latin1
DROP TABLE t1;

View File

@@ -2607,6 +2607,18 @@ rows 3
Extra Using index Extra Using index
DROP TABLE t1; DROP TABLE t1;
# #
#
# Bug#55826: create table .. select crashes with when KILL_BAD_DATA
# is returned
#
CREATE TABLE t1(a INT) ENGINE=innodb;
INSERT INTO t1 VALUES (0);
SET SQL_MODE='STRICT_ALL_TABLES';
CREATE TABLE t2
SELECT LEAST((SELECT '' FROM t1),NOW()) FROM `t1`;
ERROR 22007: Incorrect datetime value: '' for column 'NOW()' at row 2
DROP TABLE t1;
SET SQL_MODE=DEFAULT;
End of 5.1 tests End of 5.1 tests
# #
# Test for bug #39932 "create table fails if column for FK is in different # Test for bug #39932 "create table fails if column for FK is in different

View File

@@ -665,7 +665,17 @@ SELECT * FROM t1;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
DROP TABLE t1; DROP TABLE t1;
##
# 55277: Failing assertion: auto_inc > 0
#
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(c1 BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (NULL);
INSERT INTO t1 VALUES (18446744073709551615);
# Restart the server
-- source include/restart_mysqld.inc
SHOW CREATE TABLE t1;
DROP TABLE t1;
# #
# restore environment to the state it was before this test execution # restore environment to the state it was before this test execution
# #

View File

@@ -771,6 +771,20 @@ DROP TABLE t1;
--echo # --echo #
--echo #
--echo # Bug#55826: create table .. select crashes with when KILL_BAD_DATA
--echo # is returned
--echo #
CREATE TABLE t1(a INT) ENGINE=innodb;
INSERT INTO t1 VALUES (0);
SET SQL_MODE='STRICT_ALL_TABLES';
--error ER_TRUNCATED_WRONG_VALUE
CREATE TABLE t2
SELECT LEAST((SELECT '' FROM t1),NOW()) FROM `t1`;
DROP TABLE t1;
SET SQL_MODE=DEFAULT;
--echo End of 5.1 tests --echo End of 5.1 tests

View File

@@ -14,3 +14,4 @@ rpl_failed_optimize : WL#4284: Can't optimize table used by a pending tran
rpl_read_only : WL#4284: Setting Read only won't succeed until all metadata locks are released. rpl_read_only : WL#4284: Setting Read only won't succeed until all metadata locks are released.
rpl_row_create_table : Bug#51574 2010-02-27 andrei failed different way than earlier with bug#45576 rpl_row_create_table : Bug#51574 2010-02-27 andrei failed different way than earlier with bug#45576
rpl_spec_variables : BUG#47661 2009-10-27 jasonh rpl_spec_variables fails on PB2 hpux rpl_spec_variables : BUG#47661 2009-10-27 jasonh rpl_spec_variables fails on PB2 hpux
rpl_log_pos : BUG#55675 2010-09-10 alfranio rpl.rpl_log_pos fails sporadically with error binlog truncated in the middle

View File

@@ -10,4 +10,3 @@ drop table t1, t2;
sync_slave_with_master; sync_slave_with_master;
# End of 4.1 tests # End of 4.1 tests

View File

@@ -742,7 +742,6 @@ DROP TABLE t1;
--echo End of 5.1 tests --echo End of 5.1 tests
# #
# Bug#36785: Wrong error message when group_concat() exceeds max length # Bug#36785: Wrong error message when group_concat() exceeds max length
# #

View File

@@ -492,4 +492,16 @@ SELECT COALESCE(a) = COALESCE(b) FROM t1;
DROP TABLE t1; DROP TABLE t1;
--echo End of tests --echo #
--echo # Bug #54461: crash with longblob and union or update with subquery
--echo #
CREATE TABLE t1 (a INT, b LONGBLOB);
INSERT INTO t1 VALUES (1, '2'), (2, '3'), (3, '2');
SELECT DISTINCT LEAST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1;
SELECT DISTINCT GREATEST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1;
DROP TABLE t1;
--echo End of 5.1 tests

View File

@@ -404,6 +404,7 @@ create table t1 (a int, b blob);
insert into t1 values (1, ''), (2, NULL), (3, '1'); insert into t1 values (1, ''), (2, NULL), (3, '1');
select * from t1; select * from t1;
--error ER_ILLEGAL_VALUE_FOR_TYPE
select select
geometryfromtext(b) IS NULL, geometryfromwkb(b) IS NULL, astext(b) IS NULL, geometryfromtext(b) IS NULL, geometryfromwkb(b) IS NULL, astext(b) IS NULL,
aswkb(b) IS NULL, geometrytype(b) IS NULL, centroid(b) IS NULL, aswkb(b) IS NULL, geometrytype(b) IS NULL, centroid(b) IS NULL,
@@ -422,6 +423,7 @@ select
intersects(b, b) IS NULL, crosses(b, b) IS NULL intersects(b, b) IS NULL, crosses(b, b) IS NULL
from t1; from t1;
--error ER_ILLEGAL_VALUE_FOR_TYPE
select select
point(b, b) IS NULL, linestring(b) IS NULL, polygon(b) IS NULL, multipoint(b) IS NULL, point(b, b) IS NULL, linestring(b) IS NULL, polygon(b) IS NULL, multipoint(b) IS NULL,
multilinestring(b) IS NULL, multipolygon(b) IS NULL, multilinestring(b) IS NULL, multipolygon(b) IS NULL,
@@ -705,25 +707,35 @@ drop table t1;
# Bug#44684: valgrind reports invalid reads in # Bug#44684: valgrind reports invalid reads in
# Item_func_spatial_collection::val_str # Item_func_spatial_collection::val_str
# #
--error ER_ILLEGAL_VALUE_FOR_TYPE
SELECT MultiPoint(12345,''); SELECT MultiPoint(12345,'');
SELECT MultiPoint(123451,''); #SELECT MultiPoint(123451,'');
SELECT MultiPoint(1234512,''); #SELECT MultiPoint(1234512,'');
SELECT MultiPoint(12345123,''); #SELECT MultiPoint(12345123,'');
SELECT MultiLineString(12345,''); --error ER_ILLEGAL_VALUE_FOR_TYPE
SELECT MultiLineString(123451,''); #SELECT MultiLineString(12345,'');
SELECT MultiLineString(1234512,''); #SELECT MultiLineString(123451,'');
SELECT MultiLineString(12345123,''); #SELECT MultiLineString(1234512,'');
#SELECT MultiLineString(12345123,'');
SELECT LineString(12345,''); --error ER_ILLEGAL_VALUE_FOR_TYPE
SELECT LineString(123451,''); #SELECT LineString(12345,'');
SELECT LineString(1234512,''); #SELECT LineString(123451,'');
SELECT LineString(12345123,''); #SELECT LineString(1234512,'');
#SELECT LineString(12345123,'');
SELECT Polygon(12345,''); --error ER_ILLEGAL_VALUE_FOR_TYPE
SELECT Polygon(123451,''); #SELECT Polygon(12345,'');
SELECT Polygon(1234512,''); #SELECT Polygon(123451,'');
SELECT Polygon(12345123,''); #SELECT Polygon(1234512,'');
#SELECT Polygon(12345123,'');
#
# Bug55531 crash with conversions of geometry types / strings
#
--error ER_ILLEGAL_VALUE_FOR_TYPE
SELECT 1 FROM (SELECT GREATEST(1,GEOMETRYCOLLECTION('00000','00000')) b FROM DUAL) AS d WHERE (LINESTRING(d.b));
--echo # --echo #

View File

@@ -851,4 +851,74 @@ ENGINE=MERGE UNION=(t1,t2);
SELECT t1.a FROM mm1,t1; SELECT t1.a FROM mm1,t1;
DROP TABLE t1, t2, mm1; DROP TABLE t1, t2, mm1;
#--echo #
#--echo # Bug #55568: user variable assignments crash server when used within
#--echo # query
#--echo #
#
#
# This test case is invalidated because of fix of bug 55531
# The reason is that {1} is not a valid geometric collection.
#
#CREATE TABLE t1 (a INT);
#INSERT INTO t1 VALUES (0), (1);
#let $i=2;
#while ($i)
#{
# SELECT MULTIPOINT(
# 1,
# (
# SELECT MULTIPOINT(
# MULTIPOINT(
# 1,
# (SELECT COUNT(*) FROM (SELECT 1 FROM t1 GROUP BY a,a) d)
# )
# ) FROM t1
# )
# ) != COUNT(*) q FROM t1 GROUP BY a;
# dec $i;
#}
#
#DROP TABLE t1;
--echo #
--echo # Bug #54468: crash after item's print() function when ordering/grouping
--echo # by subquery
--echo #
CREATE TABLE t1(a INT, b INT);
INSERT INTO t1 VALUES (), ();
SELECT 1 FROM t1
GROUP BY
GREATEST(t1.a,
(SELECT 1 FROM
(SELECT t1.b FROM t1,t1 t2
ORDER BY t1.a, t1.a LIMIT 1) AS d)
);
DROP TABLE t1;
--echo #
--echo # Bug #53544: Server hangs during JOIN query in stored procedure called
--echo # twice in a row
--echo #
CREATE TABLE t1(c INT);
INSERT INTO t1 VALUES (1), (2);
PREPARE stmt FROM "SELECT t2.c AS f1 FROM t1 LEFT JOIN
t1 t2 ON t1.c=t2.c RIGHT JOIN
t1 t3 ON t1.c=t3.c
GROUP BY f1;";
EXECUTE stmt;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
--echo End of 5.1 tests --echo End of 5.1 tests

View File

@@ -273,5 +273,14 @@ UNLOCK TABLES;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # Bug #55424: convert_tz crashes when fed invalid data
--echo #
CREATE TABLE t1 (a SET('x') NOT NULL);
INSERT INTO t1 VALUES ('');
SELECT CONVERT_TZ(1, a, 1) FROM t1;
SELECT CONVERT_TZ(1, 1, a) FROM t1;
DROP TABLE t1;
--echo End of 5.1 tests --echo End of 5.1 tests

View File

@@ -326,6 +326,24 @@ INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
DROP TABLE t1; DROP TABLE t1;
#
# Bug #55615: debug assertion after using variable in assignment and
# referred to
# Bug #55564: crash with user variables, assignments, joins...
#
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (0),(0);
--echo # BUG#55615 : should not crash
SELECT (@a:=(SELECT @a:=1 FROM t1 LIMIT 1)) AND COUNT(1) FROM t1 GROUP BY @a;
--echo # BUG#55564 : should not crash
SELECT IF(
@v:=LEAST((SELECT 1 FROM t1 t2 LEFT JOIN t1 ON (@v) GROUP BY t1.a), a),
count(*), 1)
FROM t1 GROUP BY a LIMIT 1;
DROP TABLE t1;
--echo End of 5.1 tests --echo End of 5.1 tests
# #

View File

@@ -1564,7 +1564,7 @@ void Field::make_field(Send_field *field)
} }
else else
field->org_table_name= field->db_name= ""; field->org_table_name= field->db_name= "";
if (orig_table) if (orig_table && orig_table->alias)
{ {
field->table_name= orig_table->alias; field->table_name= orig_table->alias;
field->org_col_name= field_name; field->org_col_name= field_name;

View File

@@ -2553,7 +2553,7 @@ void Item_func_min_max::fix_length_and_dec()
stored to the value pointer, if latter is provided. stored to the value pointer, if latter is provided.
RETURN RETURN
0 If one of arguments is NULL 0 If one of arguments is NULL or there was a execution error
# index of the least/greatest argument # index of the least/greatest argument
*/ */
@@ -2567,6 +2567,14 @@ uint Item_func_min_max::cmp_datetimes(ulonglong *value)
Item **arg= args + i; Item **arg= args + i;
bool is_null; bool is_null;
longlong res= get_datetime_value(thd, &arg, 0, datetime_item, &is_null); longlong res= get_datetime_value(thd, &arg, 0, datetime_item, &is_null);
/* Check if we need to stop (because of error or KILL) and stop the loop */
if (thd->is_error())
{
null_value= 1;
return 0;
}
if ((null_value= args[i]->null_value)) if ((null_value= args[i]->null_value))
return 0; return 0;
if (i == 0 || (res < min_max ? cmp_sign : -cmp_sign) > 0) if (i == 0 || (res < min_max ? cmp_sign : -cmp_sign) > 0)
@@ -2595,6 +2603,12 @@ String *Item_func_min_max::val_str(String *str)
if (null_value) if (null_value)
return 0; return 0;
str_res= args[min_max_idx]->val_str(str); str_res= args[min_max_idx]->val_str(str);
if (args[min_max_idx]->null_value)
{
// check if the call to val_str() above returns a NULL value
null_value= 1;
return NULL;
}
str_res->set_charset(collation.collation); str_res->set_charset(collation.collation);
return str_res; return str_res;
} }
@@ -4623,6 +4637,14 @@ longlong Item_func_set_user_var::val_int_result()
return entry->val_int(&null_value); return entry->val_int(&null_value);
} }
bool Item_func_set_user_var::val_bool_result()
{
DBUG_ASSERT(fixed == 1);
check(TRUE);
update(); // Store expression
return entry->val_int(&null_value) != 0;
}
String *Item_func_set_user_var::str_result(String *str) String *Item_func_set_user_var::str_result(String *str)
{ {
DBUG_ASSERT(fixed == 1); DBUG_ASSERT(fixed == 1);

View File

@@ -1416,6 +1416,7 @@ public:
my_decimal *val_decimal(my_decimal *); my_decimal *val_decimal(my_decimal *);
double val_result(); double val_result();
longlong val_int_result(); longlong val_int_result();
bool val_bool_result();
String *str_result(String *str); String *str_result(String *str);
my_decimal *val_decimal_result(my_decimal *); my_decimal *val_decimal_result(my_decimal *);
bool is_null_result(); bool is_null_result();

View File

@@ -179,6 +179,21 @@ public:
item_type=it; item_type=it;
} }
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec()
{
for (unsigned int i= 0; i < arg_count; ++i)
{
if (args[i]->fixed && args[i]->field_type() != MYSQL_TYPE_GEOMETRY)
{
String str;
args[i]->print(&str, QT_ORDINARY);
str.append('\0');
my_error(ER_ILLEGAL_VALUE_FOR_TYPE, MYF(0), "non geometric",
str.ptr());
}
}
}
const char *func_name() const { return "multipoint"; } const char *func_name() const { return "multipoint"; }
}; };

View File

@@ -396,8 +396,8 @@ public:
bool write(Log_event* event_info); // binary log write bool write(Log_event* event_info); // binary log write
bool write(THD *thd, IO_CACHE *cache, Log_event *commit_event, bool incident); bool write(THD *thd, IO_CACHE *cache, Log_event *commit_event, bool incident);
bool write_incident(THD *thd, bool lock); bool write_incident(THD *thd, bool lock);
int write_cache(IO_CACHE *cache, bool lock_log, bool flush_and_sync); int write_cache(IO_CACHE *cache, bool lock_log, bool flush_and_sync);
void set_write_error(THD *thd); void set_write_error(THD *thd);
bool check_write_error(THD *thd); bool check_write_error(THD *thd);

View File

@@ -2411,13 +2411,8 @@ JOIN::destroy()
cleanup(1); cleanup(1);
/* Cleanup items referencing temporary table columns */ /* Cleanup items referencing temporary table columns */
if (!tmp_all_fields3.is_empty()) cleanup_item_list(tmp_all_fields1);
{ cleanup_item_list(tmp_all_fields3);
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)
@@ -2428,6 +2423,19 @@ JOIN::destroy()
DBUG_RETURN(error); DBUG_RETURN(error);
} }
void JOIN::cleanup_item_list(List<Item> &items) const
{
if (!items.is_empty())
{
List_iterator_fast<Item> it(items);
Item *item;
while ((item= it++))
item->cleanup();
}
}
/** /**
An entry point to single-unit select (a select without UNION). An entry point to single-unit select (a select without UNION).
@@ -9017,10 +9025,10 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top)
/* Flatten nested joins that can be flattened. */ /* Flatten nested joins that can be flattened. */
TABLE_LIST *right_neighbor= NULL; TABLE_LIST *right_neighbor= NULL;
bool fix_name_res= FALSE;
li.rewind(); li.rewind();
while ((table= li++)) while ((table= li++))
{ {
bool fix_name_res= FALSE;
nested_join= table->nested_join; nested_join= table->nested_join;
if (nested_join && !table->on_expr) if (nested_join && !table->on_expr)
{ {

View File

@@ -583,6 +583,7 @@ private:
*/ */
bool implicit_grouping; bool implicit_grouping;
bool make_simple_join(JOIN *join, TABLE *tmp_table); bool make_simple_join(JOIN *join, TABLE *tmp_table);
void cleanup_item_list(List<Item> &items) const;
}; };

View File

@@ -104,7 +104,7 @@ public:
inline uint32 alloced_length() const { return Alloced_length;} inline uint32 alloced_length() const { return Alloced_length;}
inline char& operator [] (uint32 i) const { return Ptr[i]; } inline char& operator [] (uint32 i) const { return Ptr[i]; }
inline void length(uint32 len) { str_length=len ; } inline void length(uint32 len) { str_length=len ; }
inline bool is_empty() { return (str_length == 0); } inline bool is_empty() const { return (str_length == 0); }
inline void mark_as_const() { Alloced_length= 0;} inline void mark_as_const() { Alloced_length= 0;}
inline const char *ptr() const { return Ptr; } inline const char *ptr() const { return Ptr; }
inline char *c_ptr() inline char *c_ptr()

View File

@@ -2300,7 +2300,7 @@ my_tz_find(THD *thd, const String *name)
DBUG_PRINT("enter", ("time zone name='%s'", DBUG_PRINT("enter", ("time zone name='%s'",
name ? ((String *)name)->c_ptr_safe() : "NULL")); name ? ((String *)name)->c_ptr_safe() : "NULL"));
if (!name) if (!name || name->is_empty())
DBUG_RETURN(0); DBUG_RETURN(0);
mysql_mutex_lock(&tz_LOCK); mysql_mutex_lock(&tz_LOCK);

View File

@@ -3761,9 +3761,10 @@ btr_cur_set_ownership_of_extern_field(
Marks not updated extern fields as not-owned by this record. The ownership Marks not updated extern fields as not-owned by this record. The ownership
is transferred to the updated record which is inserted elsewhere in the is transferred to the updated record which is inserted elsewhere in the
index tree. In purge only the owner of externally stored field is allowed index tree. In purge only the owner of externally stored field is allowed
to free the field. */ to free the field.
@return TRUE if BLOB ownership was transferred */
UNIV_INTERN UNIV_INTERN
void ibool
btr_cur_mark_extern_inherited_fields( btr_cur_mark_extern_inherited_fields(
/*=================================*/ /*=================================*/
page_zip_des_t* page_zip,/*!< in/out: compressed page whose uncompressed page_zip_des_t* page_zip,/*!< in/out: compressed page whose uncompressed
@@ -3777,13 +3778,14 @@ btr_cur_mark_extern_inherited_fields(
ulint n; ulint n;
ulint j; ulint j;
ulint i; ulint i;
ibool change_ownership = FALSE;
ut_ad(rec_offs_validate(rec, NULL, offsets)); ut_ad(rec_offs_validate(rec, NULL, offsets));
ut_ad(!rec_offs_comp(offsets) || !rec_get_node_ptr_flag(rec)); ut_ad(!rec_offs_comp(offsets) || !rec_get_node_ptr_flag(rec));
if (!rec_offs_any_extern(offsets)) { if (!rec_offs_any_extern(offsets)) {
return; return(FALSE);
} }
n = rec_offs_n_fields(offsets); n = rec_offs_n_fields(offsets);
@@ -3806,10 +3808,14 @@ btr_cur_mark_extern_inherited_fields(
btr_cur_set_ownership_of_extern_field( btr_cur_set_ownership_of_extern_field(
page_zip, rec, index, offsets, i, FALSE, mtr); page_zip, rec, index, offsets, i, FALSE, mtr);
change_ownership = TRUE;
updated: updated:
; ;
} }
} }
return(change_ownership);
} }
/*******************************************************************//** /*******************************************************************//**

View File

@@ -3542,12 +3542,19 @@ ha_innobase::innobase_initialize_autoinc()
err = row_search_max_autoinc(index, col_name, &read_auto_inc); err = row_search_max_autoinc(index, col_name, &read_auto_inc);
switch (err) { switch (err) {
case DB_SUCCESS: case DB_SUCCESS: {
/* At the this stage we do not know the increment ulonglong col_max_value;
or the offset, so use a default increment of 1. */
auto_inc = read_auto_inc + 1;
break;
col_max_value = innobase_get_int_col_max_value(field);
/* At the this stage we do not know the increment
nor the offset, so use a default increment of 1. */
auto_inc = innobase_next_autoinc(
read_auto_inc, 1, 1, col_max_value);
break;
}
case DB_RECORD_NOT_FOUND: case DB_RECORD_NOT_FOUND:
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: MySQL and InnoDB data " fprintf(stderr, " InnoDB: MySQL and InnoDB data "
@@ -3842,8 +3849,6 @@ retry:
dict_table_get_format(prebuilt->table)); dict_table_get_format(prebuilt->table));
} }
info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST);
/* Only if the table has an AUTOINC column. */ /* Only if the table has an AUTOINC column. */
if (prebuilt->table != NULL && table->found_next_number_field != NULL) { if (prebuilt->table != NULL && table->found_next_number_field != NULL) {
dict_table_autoinc_lock(prebuilt->table); dict_table_autoinc_lock(prebuilt->table);
@@ -3860,6 +3865,8 @@ retry:
dict_table_autoinc_unlock(prebuilt->table); dict_table_autoinc_unlock(prebuilt->table);
} }
info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST);
DBUG_RETURN(0); DBUG_RETURN(0);
} }

View File

@@ -456,9 +456,10 @@ btr_estimate_number_of_different_key_vals(
Marks not updated extern fields as not-owned by this record. The ownership Marks not updated extern fields as not-owned by this record. The ownership
is transferred to the updated record which is inserted elsewhere in the is transferred to the updated record which is inserted elsewhere in the
index tree. In purge only the owner of externally stored field is allowed index tree. In purge only the owner of externally stored field is allowed
to free the field. */ to free the field.
@return TRUE if BLOB ownership was transferred */
UNIV_INTERN UNIV_INTERN
void ibool
btr_cur_mark_extern_inherited_fields( btr_cur_mark_extern_inherited_fields(
/*=================================*/ /*=================================*/
page_zip_des_t* page_zip,/*!< in/out: compressed page whose uncompressed page_zip_des_t* page_zip,/*!< in/out: compressed page whose uncompressed

View File

@@ -707,6 +707,22 @@ ulint
dict_table_zip_size( dict_table_zip_size(
/*================*/ /*================*/
const dict_table_t* table); /*!< in: table */ const dict_table_t* table); /*!< in: table */
/*********************************************************************//**
Obtain exclusive locks on all index trees of the table. This is to prevent
accessing index trees while InnoDB is updating internal metadata for
operations such as truncate tables. */
UNIV_INLINE
void
dict_table_x_lock_indexes(
/*======================*/
dict_table_t* table); /*!< in: table */
/*********************************************************************//**
Release the exclusive locks on all index tree. */
UNIV_INLINE
void
dict_table_x_unlock_indexes(
/*========================*/
dict_table_t* table); /*!< in: table */
/********************************************************************//** /********************************************************************//**
Checks if a column is in the ordering columns of the clustered index of a Checks if a column is in the ordering columns of the clustered index of a
table. Column prefixes are treated like whole columns. table. Column prefixes are treated like whole columns.

View File

@@ -490,6 +490,48 @@ dict_table_zip_size(
return(dict_table_flags_to_zip_size(table->flags)); return(dict_table_flags_to_zip_size(table->flags));
} }
/*********************************************************************//**
Obtain exclusive locks on all index trees of the table. This is to prevent
accessing index trees while InnoDB is updating internal metadata for
operations such as truncate tables. */
UNIV_INLINE
void
dict_table_x_lock_indexes(
/*======================*/
dict_table_t* table) /*!< in: table */
{
dict_index_t* index;
ut_a(table);
ut_ad(mutex_own(&(dict_sys->mutex)));
/* Loop through each index of the table and lock them */
for (index = dict_table_get_first_index(table);
index != NULL;
index = dict_table_get_next_index(index)) {
rw_lock_x_lock(dict_index_get_lock(index));
}
}
/*********************************************************************//**
Release the exclusive locks on all index tree. */
UNIV_INLINE
void
dict_table_x_unlock_indexes(
/*========================*/
dict_table_t* table) /*!< in: table */
{
dict_index_t* index;
ut_a(table);
ut_ad(mutex_own(&(dict_sys->mutex)));
for (index = dict_table_get_first_index(table);
index != NULL;
index = dict_table_get_next_index(index)) {
rw_lock_x_unlock(dict_index_get_lock(index));
}
}
/********************************************************************//** /********************************************************************//**
Gets the number of fields in the internal representation of an index, Gets the number of fields in the internal representation of an index,
including fields added by the dictionary system. including fields added by the dictionary system.

View File

@@ -2808,6 +2808,15 @@ row_truncate_table_for_mysql(
trx->table_id = table->id; trx->table_id = table->id;
/* Lock all index trees for this table, as we will
truncate the table/index and possibly change their metadata.
All DML/DDL are blocked by table level lock, with
a few exceptions such as queries into information schema
about the table, MySQL could try to access index stats
for this kind of query, we need to use index locks to
sync up */
dict_table_x_lock_indexes(table);
if (table->space && !table->dir_path_of_temp_table) { if (table->space && !table->dir_path_of_temp_table) {
/* Discard and create the single-table tablespace. */ /* Discard and create the single-table tablespace. */
ulint space = table->space; ulint space = table->space;
@@ -2824,6 +2833,7 @@ row_truncate_table_for_mysql(
|| fil_create_new_single_table_tablespace( || fil_create_new_single_table_tablespace(
space, table->name, FALSE, flags, space, table->name, FALSE, flags,
FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) { FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) {
dict_table_x_unlock_indexes(table);
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: TRUNCATE TABLE %s failed to" " InnoDB: TRUNCATE TABLE %s failed to"
@@ -2927,6 +2937,10 @@ next_rec:
mem_heap_free(heap); mem_heap_free(heap);
/* Done with index truncation, release index tree locks,
subsequent work relates to table level metadata change */
dict_table_x_unlock_indexes(table);
dict_hdr_get_new_id(&new_id, NULL, NULL); dict_hdr_get_new_id(&new_id, NULL, NULL);
info = pars_info_create(); info = pars_info_create();

View File

@@ -1626,6 +1626,7 @@ row_upd_clust_rec_by_insert(
dict_table_t* table; dict_table_t* table;
dtuple_t* entry; dtuple_t* entry;
ulint err; ulint err;
ibool change_ownership = FALSE;
ut_ad(node); ut_ad(node);
ut_ad(dict_index_is_clust(index)); ut_ad(dict_index_is_clust(index));
@@ -1658,10 +1659,11 @@ row_upd_clust_rec_by_insert(
index = dict_table_get_first_index(table); index = dict_table_get_first_index(table);
offsets = rec_get_offsets(rec, index, offsets_, offsets = rec_get_offsets(rec, index, offsets_,
ULINT_UNDEFINED, &heap); ULINT_UNDEFINED, &heap);
btr_cur_mark_extern_inherited_fields( change_ownership = btr_cur_mark_extern_inherited_fields(
btr_cur_get_page_zip(btr_cur), btr_cur_get_page_zip(btr_cur),
rec, index, offsets, node->update, mtr); rec, index, offsets, node->update, mtr);
if (referenced) { if (referenced) {
/* NOTE that the following call loses /* NOTE that the following call loses
the position of pcur ! */ the position of pcur ! */
@@ -1694,10 +1696,11 @@ row_upd_clust_rec_by_insert(
row_upd_index_entry_sys_field(entry, index, DATA_TRX_ID, trx->id); row_upd_index_entry_sys_field(entry, index, DATA_TRX_ID, trx->id);
if (node->upd_ext) { if (change_ownership) {
/* If we return from a lock wait, for example, we may have /* If we return from a lock wait, for example, we may have
extern fields marked as not-owned in entry (marked in the extern fields marked as not-owned in entry (marked in the
if-branch above). We must unmark them. */ if-branch above). We must unmark them, take the ownership
back. */
btr_cur_unmark_dtuple_extern_fields(entry); btr_cur_unmark_dtuple_extern_fields(entry);