Skip to content

Commit

Permalink
unify error messages a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
vuvova committed Feb 24, 2018
1 parent 5282d0d commit 17f8e0e
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 12 deletions.
14 changes: 12 additions & 2 deletions mysql-test/suite/versioning/r/truncate.result
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,24 @@ create or replace table t (i int) with system versioning;
delete history from t;
create or replace view v as select * from t;
delete history from v;
ERROR HY000: DELETE HISTORY from VIEW is prohibited
ERROR 42S02: 'v' is a view
create or replace table t (i int);
delete history from t;
ERROR HY000: Table `t` is not system-versioned
create or replace view v as select * from t;
delete history from v;
ERROR HY000: DELETE HISTORY from VIEW is prohibited
ERROR 42S02: 'v' is a view
prepare stmt from 'delete history from t';
ERROR HY000: Table `t` is not system-versioned
drop table t;
drop view v;
create or replace table t (i int);
create or replace view v as select * from t;
drop table v;
ERROR 42S02: 'test.v' is a view
lock table v write;
delete history from v before system_time now(6);
ERROR 42S02: 'v' is a view
unlock tables;
drop view v;
drop table t;
18 changes: 16 additions & 2 deletions mysql-test/suite/versioning/t/truncate.test
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,31 @@ select * from t for system_time all;
create or replace table t (i int) with system versioning;
delete history from t;
create or replace view v as select * from t;
--error ER_VERS_TRUNCATE_VIEW
--error ER_IT_IS_A_VIEW
delete history from v;

create or replace table t (i int);
--error ER_VERS_NOT_VERSIONED
delete history from t;
create or replace view v as select * from t;
--error ER_VERS_TRUNCATE_VIEW
--error ER_IT_IS_A_VIEW
delete history from v;
--error ER_VERS_NOT_VERSIONED
prepare stmt from 'delete history from t';

drop table t;
drop view v;

#
# MDEV-15402 Assertion `table' failed in mysql_delete on attempt to delete history from view
#
create or replace table t (i int);
create or replace view v as select * from t;
--error ER_IT_IS_A_VIEW
drop table v;
lock table v write;
--error ER_IT_IS_A_VIEW
delete history from v before system_time now(6);
unlock tables;
drop view v;
drop table t;
8 changes: 4 additions & 4 deletions sql/share/errmsg-utf8.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7897,14 +7897,14 @@ ER_VERS_DUPLICATE_ROW_START_END
ER_VERS_ALREADY_VERSIONED
eng "Table %`s is already system-versioned"

ER_VERS_TRUNCATE_VIEW
eng "DELETE HISTORY from VIEW is prohibited"
ER_UNUSED_24
eng "You should never see it"

ER_VERS_TEMPORARY
eng "System versioning prohibited for TEMPORARY tables"

ER_VERS_INPLACE_NOT_IMPLEMENTED
eng "Not implemented for system-versioned tables"
ER_VERS_NOT_SUPPORTED
eng "%s is not supported for %s system-versioned tables"
ER_INDEX_FILE_FULL
eng "The index file for table '%-.192s' is full"
ER_UPDATED_COLUMN_ONLY_ONCE
Expand Down
4 changes: 2 additions & 2 deletions sql/sql_delete.cc
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
{
if (table_list->is_view_or_derived())
{
my_error(ER_VERS_TRUNCATE_VIEW, MYF(0));
my_error(ER_IT_IS_A_VIEW, MYF(0), table_list->table_name.str);
DBUG_RETURN(true);
}

Expand Down Expand Up @@ -938,7 +938,7 @@ l
{
if (table_list->is_view())
{
my_error(ER_VERS_TRUNCATE_VIEW, MYF(0));
my_error(ER_IT_IS_A_VIEW, MYF(0), table_list->table_name.str);
DBUG_RETURN(true);
}
if (select_lex->vers_setup_conds(thd, table_list, conds))
Expand Down
4 changes: 2 additions & 2 deletions storage/innobase/handler/handler0alter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ ha_innobase::check_if_supported_inplace_alter(
if ((table->versioned(VERS_TIMESTAMP) || altered_table->versioned(VERS_TIMESTAMP))
&& innobase_need_rebuild(ha_alter_info, table)) {
ha_alter_info->unsupported_reason =
innobase_get_err_msg(ER_VERS_INPLACE_NOT_IMPLEMENTED);
"Not implemented for system-versioned tables";
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
}

Expand Down Expand Up @@ -1239,7 +1239,7 @@ ha_innobase::check_if_supported_inplace_alter(
if ((table->versioned(VERS_TRX_ID) || altered_table->versioned(VERS_TRX_ID))
&& innobase_need_rebuild(ha_alter_info, table)) {
ha_alter_info->unsupported_reason =
innobase_get_err_msg(ER_VERS_INPLACE_NOT_IMPLEMENTED);
"Not implemented for system-versioned tables";
online = false;
}

Expand Down

0 comments on commit 17f8e0e

Please sign in to comment.