MDEV-16792 Assertion `m_status == DA_ERROR' failed in Diagnostics_area::sql_errno or wrong result upon SHOW TABLE STATUS after adding partition under ANSI_QUOTES

if opening a table fails with a syntax error, the error shouldn't
be suppressed completely as if it didn't happen at all.
This commit is contained in:
Sergei Golubchik 2018-09-21 19:56:55 +02:00
parent 1ebec10375
commit e4b466aa3d
3 changed files with 23 additions and 3 deletions

View File

@ -103,3 +103,15 @@ t_partition CREATE TABLE `t_partition` (
PARTITION BY HASH (`f1`)
PARTITIONS 2
drop table t_partition;
create table t1 (a int) partition by range(a) (partition p0 values less than (5));
set sql_mode='ansi_quotes';
alter table t1 add partition (partition p1 values less than (10));
set sql_mode= default;
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"p0" VALUES LESS THAN (5) ENGINE = MyISAM,
PARTITION "p1" VALUES LESS THAN (10)' at line 2
Warnings:
Warning 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"p0" VALUES LESS THAN (5) ENGINE = MyISAM,
PARTITION "p1" VALUES LESS THAN (10)' at line 2
drop table t1;

View File

@ -39,3 +39,13 @@ create table t_partition (f1 int) partition by hash(f1) partitions 2;
select * from t_partition as tbl;
show create table t_partition;
drop table t_partition;
#
# MDEV-16792 Assertion `m_status == DA_ERROR' failed in Diagnostics_area::sql_errno or wrong result upon SHOW TABLE STATUS after adding partition under ANSI_QUOTES
#
create table t1 (a int) partition by range(a) (partition p0 values less than (5));
set sql_mode='ansi_quotes';
alter table t1 add partition (partition p1 values less than (10));
set sql_mode= default;
show table status;
drop table t1;

View File

@ -4795,9 +4795,7 @@ public:
const char* msg,
Sql_condition ** cond_hdl)
{
if (sql_errno == ER_PARSE_ERROR ||
sql_errno == ER_TRG_NO_DEFINER ||
sql_errno == ER_TRG_NO_CREATION_CTX)
if (sql_errno == ER_TRG_NO_DEFINER || sql_errno == ER_TRG_NO_CREATION_CTX)
return true;
if (*level != Sql_condition::WARN_LEVEL_ERROR)