From 6542511572e91ed3077e91bf9a3b6c40cf5ede51 Mon Sep 17 00:00:00 2001 From: Rucha Deodhar Date: Tue, 28 Jul 2020 13:43:25 +0530 Subject: MDEV-21017: Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed or late ER_PERIOD_FIELD_WRONG_ATTRIBUTES upon attempt to create existing table Analysis: Error state is not stored when field is checked in Table_period_info::check_field() Fix: Store error state by setting res to true. --- mysql-test/main/create.result | 15 +++++++++++++++ mysql-test/main/create.test | 18 ++++++++++++++++++ sql/handler.cc | 1 + 3 files changed, 34 insertions(+) diff --git a/mysql-test/main/create.result b/mysql-test/main/create.result index c1733c270a7..2905103b707 100644 --- a/mysql-test/main/create.result +++ b/mysql-test/main/create.result @@ -2012,3 +2012,18 @@ CREATE TABLE t1 ( id1 INT, id2 INT, CONSTRAINT `foo` PRIMARY KEY (id1), CONSTRAI Warnings: Warning 1280 Name 'foo' ignored for PRIMARY key. DROP TABLE t1; +# +# 10.4 Test +# +# MDEV-21017: Assertion `!is_set() || (m_status == DA_OK_BULK && +# is_bulk_op())' failed or late ER_PERIOD_FIELD_WRONG_ATTRIBUTES +# upon attempt to create existing table +# +CREATE TABLE t1 (a INT); +LOCK TABLE t1 WRITE; +CREATE TABLE IF NOT EXISTS t1 (s DATE GENERATED ALWAYS AS ('2000-01-01') STORED, +e DATE, PERIOD FOR app(s,e)); +ERROR HY000: Period field `s` cannot be GENERATED ALWAYS AS +UNLOCK TABLES; +DROP TABLE t1; +# End of 10.4 Test diff --git a/mysql-test/main/create.test b/mysql-test/main/create.test index 64aea4ddcf1..a6a6ba0c782 100644 --- a/mysql-test/main/create.test +++ b/mysql-test/main/create.test @@ -1873,3 +1873,21 @@ drop table t1; CREATE TABLE t1 ( id1 INT, id2 INT, CONSTRAINT `foo` PRIMARY KEY (id1), CONSTRAINT `bar` UNIQUE KEY(id2)); DROP TABLE t1; +--echo # +--echo # 10.4 Test +--echo # +--echo # MDEV-21017: Assertion `!is_set() || (m_status == DA_OK_BULK && +--echo # is_bulk_op())' failed or late ER_PERIOD_FIELD_WRONG_ATTRIBUTES +--echo # upon attempt to create existing table +--echo # +CREATE TABLE t1 (a INT); +LOCK TABLE t1 WRITE; + +--error ER_PERIOD_FIELD_WRONG_ATTRIBUTES +CREATE TABLE IF NOT EXISTS t1 (s DATE GENERATED ALWAYS AS ('2000-01-01') STORED, +e DATE, PERIOD FOR app(s,e)); + +UNLOCK TABLES; +DROP TABLE t1; + +--echo # End of 10.4 Test diff --git a/sql/handler.cc b/sql/handler.cc index 5f94f9e893b..21922ec9d73 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -7856,6 +7856,7 @@ bool Table_period_info::check_field(const Create_field* f, { my_error(ER_PERIOD_FIELD_WRONG_ATTRIBUTES, MYF(0), f->field_name.str, "GENERATED ALWAYS AS"); + res= true; } return res; -- cgit v1.2.1