diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2022-07-08 11:38:45 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2022-07-12 11:12:55 +0200 |
commit | 8494758e8e06aea5c8d4cddcff6c0a913bac4d23 (patch) | |
tree | 9a70e9db535de4559fe4b51369c460f26e926e98 | |
parent | fc456bc97e8dfe08667e3ddd36941a3bd4dde340 (diff) | |
download | mariadb-git-8494758e8e06aea5c8d4cddcff6c0a913bac4d23.tar.gz |
MDEV-26433 assertion: table->get_ref_count() == 0 in dict0dict.cc line 1915
Close handlers in THD::drop_temporary_table.
-rw-r--r-- | mysql-test/main/insert_innodb.result | 12 | ||||
-rw-r--r-- | mysql-test/main/insert_innodb.test | 17 | ||||
-rw-r--r-- | sql/temporary_tables.cc | 4 |
3 files changed, 33 insertions, 0 deletions
diff --git a/mysql-test/main/insert_innodb.result b/mysql-test/main/insert_innodb.result index e5e2b4b8623..314412bcfdd 100644 --- a/mysql-test/main/insert_innodb.result +++ b/mysql-test/main/insert_innodb.result @@ -43,3 +43,15 @@ INSERT IGNORE INTO t2 VALUES('abc', 2) ON DUPLICATE KEY UPDATE fld1= 'def'; Warnings: Warning 1452 Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `fk` FOREIGN KEY (`fld2`) REFERENCES `t1` (`fld1`)) DROP TABLE t2, t1; +# +# MDEV-26433: assertion: table->get_ref_count() == 0 in dict0dict.cc +# line 1915 +# +CREATE TEMPORARY TABLE v0 ( v1 TEXT ( 15 ) CHAR SET BINARY NOT NULL NOT NULL UNIQUE CHECK ( v1 ) ) REPLACE SELECT NULL AS v3 , 74 AS v2 ; +ERROR HY000: Field 'v1' doesn't have a default value +CREATE TEMPORARY TABLE t1 (i TEXT(15) NOT NULL DEFAULT '' UNIQUE CHECK (i)) engine=innodb +REPLACE SELECT NULL AS a; +ERROR HY000: Field 'DB_ROW_HASH_1' doesn't have a default value +# +# End of 10.5 tests +# diff --git a/mysql-test/main/insert_innodb.test b/mysql-test/main/insert_innodb.test index 68b6ca4e315..b5a9fc72c07 100644 --- a/mysql-test/main/insert_innodb.test +++ b/mysql-test/main/insert_innodb.test @@ -62,3 +62,20 @@ INSERT IGNORE INTO t2 VALUES('abc', 2) ON DUPLICATE KEY UPDATE fld1= 'def'; --disable_warnings DROP TABLE t2, t1; + +--echo # +--echo # MDEV-26433: assertion: table->get_ref_count() == 0 in dict0dict.cc +--echo # line 1915 +--echo # + +--error ER_NO_DEFAULT_FOR_FIELD +CREATE TEMPORARY TABLE v0 ( v1 TEXT ( 15 ) CHAR SET BINARY NOT NULL NOT NULL UNIQUE CHECK ( v1 ) ) REPLACE SELECT NULL AS v3 , 74 AS v2 ; + +--error ER_NO_DEFAULT_FOR_FIELD +CREATE TEMPORARY TABLE t1 (i TEXT(15) NOT NULL DEFAULT '' UNIQUE CHECK (i)) engine=innodb + REPLACE SELECT NULL AS a; + + +--echo # +--echo # End of 10.5 tests +--echo # diff --git a/sql/temporary_tables.cc b/sql/temporary_tables.cc index f3264a4c809..65aa6c3c28b 100644 --- a/sql/temporary_tables.cc +++ b/sql/temporary_tables.cc @@ -625,6 +625,10 @@ bool THD::drop_temporary_table(TABLE *table, bool *is_trans, bool delete_table) DBUG_PRINT("tmptable", ("Dropping table: '%s'.'%s'", table->s->db.str, table->s->table_name.str)); + // close all handlers in case it is statement abort and some can be left + if (is_error()) + table->file->ha_reset(); + locked= lock_temporary_tables(); share= tmp_table_share(table); |