diff options
author | Davi Arnaut <Davi.Arnaut@Sun.COM> | 2010-07-06 14:38:03 -0300 |
---|---|---|
committer | Davi Arnaut <Davi.Arnaut@Sun.COM> | 2010-07-06 14:38:03 -0300 |
commit | 6eb854de1f2cf96fe16a77cf89e7a97809b6dd4f (patch) | |
tree | ff890169e5b98f3fbb31ea046586032110b94897 /mysql-test/r/partition_innodb.result | |
parent | e1bbe2443cf9abe74320d138f74c0f4d4959b68c (diff) | |
download | mariadb-git-6eb854de1f2cf96fe16a77cf89e7a97809b6dd4f.tar.gz |
Bug#54783: optimize table crashes with invalid timestamp default
value and NO_ZERO_DATE
The problem was that a older version of the error path for a
failed admin statement relied upon a few error conditions being
met in order to access a table handler, the first one being that
the table object pointer was not NULL. Probably due to chance,
in all cases a table object was closed but the reference wasn't
reset, the other conditions didn't evaluate to true. With the
addition of a new check on the error path, the handler started
being dereferenced whenever it was not reset to NULL, causing
problems for code paths which closed the table but didn't reset
the reference.
The solution is to reset the reference whenever a admin statement
fails and the tables are closed.
mysql-test/r/partition_innodb.result:
Add test case result for Bug#54783
mysql-test/t/partition_innodb.test:
Add test case for Bug#54783
sql/sql_table.cc:
In case table recreate failed, set a appropriate result code.
Reset reference to a closed table object, otherwise the error
path might attempt to access it.
Diffstat (limited to 'mysql-test/r/partition_innodb.result')
-rw-r--r-- | mysql-test/r/partition_innodb.result | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result index 8ae16238a18..58d014938bf 100644 --- a/mysql-test/r/partition_innodb.result +++ b/mysql-test/r/partition_innodb.result @@ -373,3 +373,21 @@ CREATE TABLE t1 (a INT) ENGINE=InnoDB PARTITION BY list(a) (PARTITION p1 VALUES IN (1)); CREATE INDEX i1 ON t1 (a); DROP TABLE t1; +# +# Bug#54783: optimize table crashes with invalid timestamp default value and NO_ZERO_DATE +# +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (a INT, b TIMESTAMP DEFAULT '0000-00-00 00:00:00') +ENGINE=INNODB PARTITION BY LINEAR HASH (a) PARTITIONS 1; +SET @old_mode = @@sql_mode; +SET SESSION sql_mode = 'NO_ZERO_DATE'; +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize error Invalid default value for 'b' +test.t1 optimize status Operation failed +Warnings: +Warning 1265 Data truncated for column 'b' at row 1 +Error 1067 Invalid default value for 'b' +SET SESSION sql_mode = @old_mode; +DROP TABLE t1; |