summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorNikita Malyavin <nikitamalyavin@gmail.com>2021-08-02 14:24:54 +0300
committerNikita Malyavin <nikitamalyavin@gmail.com>2021-10-20 15:15:21 +0300
commit1811fd51fbae9e6c1f06ce93faef2bf1279cd3b6 (patch)
tree09ac85ad2477fd90218fb7a4db3c10bbc497ed59 /sql
parenta8401ad5afd766d2febc63a8bcfedda2978ff44c (diff)
downloadmariadb-git-1811fd51fbae9e6c1f06ce93faef2bf1279cd3b6.tar.gz
MDEV-26262 frm is corrupted after ER_EXPRESSION_REFERS_TO_UNINIT_FIELD
This is a duplicate of MDEV-18278 89936f11e965, but I will add an additional assertion Description: The frm corruption should not be reported during CREATE TABLE. Normally it doesn't, and the data to fill TABLE is taken by open_table_from_share call. However, the vcol data is stored as SQL string in table->s->vcol_defs.str and is anyway parsed on each table open. It is impossible [or hard] to avoid, because it's hard to clone the expression tree in general (it's easier to parse). Normally parse_vcol_defs should only fail on semantic errors. If so, error_reported is set to true. Any other failure is not expected during table creation. There is either unhandled/unacknowledged error, or something went really wrong, like memory reject. This all should be asserted anyway. Solution: * Set *error_reported=true for the forward references check; * Assert for every unacknowledged error during table creation.
Diffstat (limited to 'sql')
-rw-r--r--sql/table.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/sql/table.cc b/sql/table.cc
index d4f8170e0af..349d04a60ed 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -3282,6 +3282,9 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share,
&error_reported, mode))
{
error= OPEN_FRM_CORRUPTED;
+ // parse_vcol_defs may fail by semantic reasons, which is ok, but the
+ // real corruption should never be reported during table creation
+ DBUG_ASSERT(!is_create_table || !error_reported);
goto err;
}