summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2021-09-28 16:00:41 +0300
committerAleksey Midenkov <midenok@gmail.com>2021-10-11 12:26:43 +0300
commit89936f11e965472d65fbee1e240f3d4b7726e77f (patch)
tree1efff51b571440867c184fdbfb3720b8c507066e
parent275e7d23f73f036b31b2d67f9256008c8e5561e1 (diff)
downloadmariadb-git-89936f11e965472d65fbee1e240f3d4b7726e77f.tar.gz
MDEV-18278 Misleading error message in error log upon failed table creation
If error_reported is not set upper caller open_table_from_share() throws error ER_NOT_FORM_FILE itself via open_table_error().
-rw-r--r--mysql-test/r/default.result8
-rw-r--r--mysql-test/t/default.test6
-rw-r--r--sql/table.cc3
3 files changed, 17 insertions, 0 deletions
diff --git a/mysql-test/r/default.result b/mysql-test/r/default.result
index 369734ae92a..1a35a29aa7f 100644
--- a/mysql-test/r/default.result
+++ b/mysql-test/r/default.result
@@ -3396,4 +3396,12 @@ CREATE OR REPLACE TABLE t1(i int);
ALTER TABLE t1 ADD b CHAR(255) DEFAULT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`;
ERROR 42S22: Unknown column 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' in 'DEFAULT'
DROP TABLE t1;
+#
+# MDEV-18278 Misleading error message in error log upon failed table creation
+#
+create table t1 (a int as (a));
+ERROR 01000: Expression for field `a` is referring to uninitialized field `a`
+show warnings;
+Level Code Message
+Error 4029 Expression for field `a` is referring to uninitialized field `a`
# end of 10.2 test
diff --git a/mysql-test/t/default.test b/mysql-test/t/default.test
index aec518d94a6..472b1fa4796 100644
--- a/mysql-test/t/default.test
+++ b/mysql-test/t/default.test
@@ -2109,5 +2109,11 @@ CREATE OR REPLACE TABLE t1(i int);
ALTER TABLE t1 ADD b CHAR(255) DEFAULT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`;
DROP TABLE t1;
+--echo #
+--echo # MDEV-18278 Misleading error message in error log upon failed table creation
+--echo #
+--error ER_EXPRESSION_REFERS_TO_UNINIT_FIELD
+create table t1 (a int as (a));
+show warnings;
--echo # end of 10.2 test
diff --git a/sql/table.cc b/sql/table.cc
index 281b8f82abc..87b3c158a67 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -1157,7 +1157,10 @@ bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table,
if (check_vcol_forward_refs(field, field->vcol_info) ||
check_vcol_forward_refs(field, field->check_constraint) ||
check_vcol_forward_refs(field, field->default_value))
+ {
+ *error_reported= true;
goto end;
+ }
}
res=0;