diff --git a/include/my_sys.h b/include/my_sys.h index 211e0baa0de..e8658d34af9 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -715,7 +715,6 @@ extern int my_sync(File fd, myf my_flags); extern int my_sync_dir(const char *dir_name, myf my_flags); extern int my_sync_dir_by_file(const char *file_name, myf my_flags); extern const char *my_get_err_msg(uint nr); -extern void my_error_as(uint nr1, uint nr2, myf MyFlags, ...); extern int my_error_register(const char** (*get_errmsgs) (int nr), uint first, uint last); extern my_bool my_error_unregister(uint first, uint last); diff --git a/mysql-test/suite/versioning/r/optimized.result b/mysql-test/suite/versioning/r/optimized.result index b28bc281597..b28b867f8fc 100644 --- a/mysql-test/suite/versioning/r/optimized.result +++ b/mysql-test/suite/versioning/r/optimized.result @@ -17,59 +17,59 @@ a b b+0 1 NULL NULL 3 NULL NULL Warnings: -Warning 4109 Attempt to read unversioned field `b` in historical query -Warning 4109 Attempt to read unversioned field `b` in historical query +Warning 4108 Attempt to read unversioned field `b` in historical query +Warning 4108 Attempt to read unversioned field `b` in historical query select * from t for system_time as of timestamp now(6); a b 1 NULL 3 NULL Warnings: -Warning 4109 Attempt to read unversioned field `b` in historical query +Warning 4108 Attempt to read unversioned field `b` in historical query select count(*) from t group by b for system_time as of timestamp now(6); count(*) 2 Warnings: -Warning 4109 Attempt to read unversioned field `b` in historical query +Warning 4108 Attempt to read unversioned field `b` in historical query select * from t for system_time as of timestamp now(6) order by b asc; a b 1 NULL 3 NULL Warnings: -Warning 4109 Attempt to read unversioned field `b` in historical query -Warning 4109 Attempt to read unversioned field `b` in historical query +Warning 4108 Attempt to read unversioned field `b` in historical query +Warning 4108 Attempt to read unversioned field `b` in historical query select * from t for system_time as of timestamp now(6) order by b desc; a b 1 NULL 3 NULL Warnings: -Warning 4109 Attempt to read unversioned field `b` in historical query -Warning 4109 Attempt to read unversioned field `b` in historical query +Warning 4108 Attempt to read unversioned field `b` in historical query +Warning 4108 Attempt to read unversioned field `b` in historical query select * from t group by a having a=2 for system_time as of timestamp now(6); a b Warnings: -Warning 4109 Attempt to read unversioned field `b` in historical query +Warning 4108 Attempt to read unversioned field `b` in historical query select * from t group by b having b=2 for system_time as of timestamp now(6); a b Warnings: -Warning 4109 Attempt to read unversioned field `b` in historical query +Warning 4108 Attempt to read unversioned field `b` in historical query select a from t where b=2 for system_time as of timestamp now(6); a Warnings: -Warning 4109 Attempt to read unversioned field `b` in historical query +Warning 4108 Attempt to read unversioned field `b` in historical query select a from t where b=NULL for system_time as of timestamp now(6); a Warnings: -Warning 4109 Attempt to read unversioned field `b` in historical query +Warning 4108 Attempt to read unversioned field `b` in historical query select a from t where b is NULL for system_time as of timestamp now(6); a 1 3 Warnings: -Warning 4109 Attempt to read unversioned field `b` in historical query +Warning 4108 Attempt to read unversioned field `b` in historical query select count(*), b from t group by b having b=NULL for system_time as of timestamp now(6); count(*) b Warnings: -Warning 4109 Attempt to read unversioned field `b` in historical query +Warning 4108 Attempt to read unversioned field `b` in historical query select a, b from t; a b 1 2 @@ -78,29 +78,29 @@ select count(*) from t for system_time as of timestamp now(6) group by b; count(*) 2 Warnings: -Warning 4109 Attempt to read unversioned field `b` in historical query +Warning 4108 Attempt to read unversioned field `b` in historical query select * from t for system_time as of timestamp now(6) group by b having b=2; a b Warnings: -Warning 4109 Attempt to read unversioned field `b` in historical query +Warning 4108 Attempt to read unversioned field `b` in historical query select a from t for system_time as of timestamp now(6) where b=2; a Warnings: -Warning 4109 Attempt to read unversioned field `b` in historical query +Warning 4108 Attempt to read unversioned field `b` in historical query select a from t for system_time as of timestamp now(6) where b=NULL; a Warnings: -Warning 4109 Attempt to read unversioned field `b` in historical query +Warning 4108 Attempt to read unversioned field `b` in historical query select a from t for system_time as of timestamp now(6) where b is NULL; a 1 3 Warnings: -Warning 4109 Attempt to read unversioned field `b` in historical query +Warning 4108 Attempt to read unversioned field `b` in historical query select count(*), b from t for system_time as of timestamp now(6) group by b having b=NULL; count(*) b Warnings: -Warning 4109 Attempt to read unversioned field `b` in historical query +Warning 4108 Attempt to read unversioned field `b` in historical query create or replace table t ( a int, b int not null without system versioning @@ -111,12 +111,12 @@ a b 1 NULL 3 NULL Warnings: -Warning 4109 Attempt to read unversioned field `b` in historical query +Warning 4108 Attempt to read unversioned field `b` in historical query select * from t for system_time as of timestamp now(6) where b is NULL; a b 1 NULL 3 NULL Warnings: -Warning 4109 Attempt to read unversioned field `b` in historical query -Warning 4109 Attempt to read unversioned field `b` in historical query +Warning 4108 Attempt to read unversioned field `b` in historical query +Warning 4108 Attempt to read unversioned field `b` in historical query drop table t; diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result index 58ac879c3e2..2bca840d4cc 100644 --- a/mysql-test/suite/versioning/r/partition.result +++ b/mysql-test/suite/versioning/r/partition.result @@ -72,7 +72,7 @@ ERROR HY000: Wrong partitions consistency for `t1`: must have at least one 'VERS alter table t1 add partition ( partition p1 versioning); Warnings: -Warning 4112 Maybe missing parameters: no rotation condition for multiple `VERSIONING` partitions. +Warning 4111 Maybe missing parameters: no rotation condition for multiple `VERSIONING` partitions. show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -209,7 +209,7 @@ x 2 delete from t1; Warnings: -Note 4113 Switching from partition `p0` to `p1` +Note 4112 Switching from partition `p0` to `p1` select * from t1 partition (p0) for system_time all; x 1 @@ -219,7 +219,7 @@ x insert into t1 values (3); delete from t1; Warnings: -Warning 4111 Using full partition `p1`, need more VERSIONING partitions! +Warning 4110 Using full partition `p1`, need more VERSIONING partitions! select * from t1 partition (p1) for system_time all; x 2 @@ -252,7 +252,7 @@ x insert into t1 values (4); delete from t1; Warnings: -Note 4113 Switching from partition `p0` to `p1` +Note 4112 Switching from partition `p0` to `p1` select * from t1 partition (p1) for system_time all; x 4 @@ -274,8 +274,8 @@ x 2 delete from t1; Warnings: -Note 4113 Switching from partition `p0` to `p1` -Warning 4111 Using full partition `p1`, need more VERSIONING partitions! +Note 4112 Switching from partition `p0` to `p1` +Warning 4110 Using full partition `p1`, need more VERSIONING partitions! select * from t1 partition (p0sp0) for system_time all; x 1 diff --git a/mysql-test/suite/versioning/t/alter.test b/mysql-test/suite/versioning/t/alter.test index 2b45d6cc0c8..7176a704ebc 100644 --- a/mysql-test/suite/versioning/t/alter.test +++ b/mysql-test/suite/versioning/t/alter.test @@ -4,7 +4,7 @@ create table t( a int ); show create table t; ---error ER_VERS_WRONG_PARAMS +--error ER_VERS_NOT_VERSIONED alter table t drop system versioning; alter table t add system versioning; @@ -122,9 +122,9 @@ alter table t drop system versioning; select * from t; show create table t; ---error ER_VERS_WRONG_PARAMS +--error ER_VERS_NOT_VERSIONED alter table t modify a int with system versioning; ---error ER_VERS_WRONG_PARAMS +--error ER_VERS_NOT_VERSIONED alter table t modify a int without system versioning; alter table t add system versioning; diff --git a/mysql-test/suite/versioning/t/create.test b/mysql-test/suite/versioning/t/create.test index ba04817580d..903ff997f12 100644 --- a/mysql-test/suite/versioning/t/create.test +++ b/mysql-test/suite/versioning/t/create.test @@ -39,7 +39,7 @@ create or replace table t1 ( show create table t1; --replace_result "bigint unsigned" SYS_TRX_TYPE timestamp(6) SYS_TRX_TYPE ---error ER_VERS_WRONG_PARAMS +--error ER_MISMATCH eval create or replace table t1 ( x3 int unsigned, Sys_start $sys_datatype generated always as row start, @@ -49,7 +49,7 @@ eval create or replace table t1 ( ) with system versioning; --replace_result "bigint unsigned" SYS_TRX_TYPE timestamp(6) SYS_TRX_TYPE ---error ER_VERS_WRONG_PARAMS +--error ER_MISMATCH eval create or replace table t1 ( x4 int unsigned, Sys_start $sys_datatype generated always as row start, @@ -58,7 +58,7 @@ eval create or replace table t1 ( ) with system versioning; --replace_result "bigint unsigned" SYS_TRX_TYPE timestamp(6) SYS_TRX_TYPE ---error ER_VERS_WRONG_PARAMS +--error ER_MISMATCH eval create or replace table t1 ( x5 int unsigned, Sys_start $sys_datatype generated always as row start, @@ -67,14 +67,14 @@ eval create or replace table t1 ( period for system_time (Sys_start, Sys_end) ) with system versioning; ---error ER_VERS_WRONG_PARAMS +--error ER_MISSING create or replace table t1 ( x6 int unsigned, period for system_time (Sys_start, Sys_end) ) with system versioning; --replace_result "bigint unsigned" SYS_TRX_TYPE timestamp(6) SYS_TRX_TYPE ---error ER_VERS_WRONG_PARAMS +--error ER_MISSING eval create or replace table t1 ( x7 int unsigned, Sys_start $sys_datatype generated always as row start, @@ -84,7 +84,7 @@ eval create or replace table t1 ( ); --replace_result "bigint unsigned" SYS_TRX_TYPE timestamp(6) SYS_TRX_TYPE ---error ER_VERS_WRONG_PARAMS +--error ER_MISMATCH eval create or replace table t1 ( x8 int unsigned, Sys_start $sys_datatype generated always as row start, @@ -93,7 +93,7 @@ eval create or replace table t1 ( ) with system versioning; --replace_result "bigint unsigned" SYS_TRX_TYPE timestamp(6) SYS_TRX_TYPE ---error ER_VERS_WRONG_PARAMS +--error ER_MISSING eval create or replace table t1 ( x9 int unsigned, Sys_start $sys_datatype generated always as row start, @@ -102,7 +102,7 @@ eval create or replace table t1 ( ); --replace_result "bigint unsigned" SYS_TRX_TYPE timestamp(6) SYS_TRX_TYPE ---error ER_VERS_WRONG_PARAMS +--error ER_MISSING eval create or replace table t1 ( x10 int unsigned, Sys_start $sys_datatype generated always as row start, @@ -188,7 +188,7 @@ create or replace table t1 ( A7 int without system versioning ); ---error ER_VERS_WRONG_PARAMS +--error ER_VERS_NO_COLS_DEFINED create or replace table t1 ( A8 int without system versioning ) with system versioning; @@ -253,7 +253,7 @@ create or replace table t3 with system versioning select * from t1 for system_ti show create table t3; create or replace table t2 with system versioning as select * from t0; ---error ER_VERS_WRONG_PARAMS +--error ER_VERS_DIFFERENT_TABLES create or replace table t3 with system versioning select x, y, t1.sys_trx_start, t2.en from t1, t2; insert into t2 values (1), (2); diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test index 7abaf591a4e..12143647770 100644 --- a/mysql-test/suite/versioning/t/partition.test +++ b/mysql-test/suite/versioning/t/partition.test @@ -152,7 +152,7 @@ select @ts0 = @ts1; select @ts2 = @ts3; # rotation by LIMIT ---error ER_VERS_WRONG_PARAMS +--error ER_PART_WRONG_VALUE create or replace table t1 (x int) with system versioning partition by system_time limit 0 ( @@ -184,7 +184,7 @@ delete from t1; select * from t1 partition (p1) for system_time all; # rotation by INTERVAL ---error ER_VERS_WRONG_PARAMS +--error ER_PART_WRONG_VALUE create or replace table t1 (x int) with system versioning partition by system_time interval 0 second ( diff --git a/mysys/my_error.c b/mysys/my_error.c index d57c186b2f3..f9614e07c6a 100644 --- a/mysys/my_error.c +++ b/mysys/my_error.c @@ -327,39 +327,3 @@ void my_error_unregister_all(void) my_errmsgs_list= &my_errmsgs_globerrs; } - - -/** - Format one error and print out as another error code. - - @note - Stacks two error messages and prints as single error message. - Like my_error(), but error argument is another formatted error - - @param nr1 error number of printed message. nr1 must have exactly one %s - parameter which will be formatted message of error nr2. - @param nr2 error number of formatted message - @param MyFlags Flags - @param ... parameters for error nr2 -*/ - -void my_error_as(uint nr1, uint nr2, myf MyFlags, ...) -{ - const char *format; - va_list args; - char ebuff[ERRMSGSIZE]; - DBUG_ENTER("my_suberror"); - DBUG_PRINT("my", ("nr1: %d nr2: %d MyFlags: %lu errno: %d", nr1, nr2, MyFlags, errno)); - - if (!(format = my_get_err_msg(nr2))) - (void) my_snprintf(ebuff, sizeof(ebuff), "Unknown error %d", nr2); - else - { - va_start(args,MyFlags); - (void) my_vsnprintf_ex(&my_charset_utf8_general_ci, ebuff, - sizeof(ebuff), format, args); - va_end(args); - } - my_error(nr1, MyFlags, ebuff); - DBUG_VOID_RETURN; -} diff --git a/sql/handler.cc b/sql/handler.cc index 28e304496b6..1f46e14e173 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -6823,8 +6823,7 @@ bool Vers_parse_info::check_and_fix_implicit( if ((system_time.start || system_time.end || as_row.start || as_row.end) && !with_system_versioning) { - my_error_as(ER_VERS_WRONG_PARAMS, ER_MISSING, MYF(0), table_name, - "WITH SYSTEM VERSIONING"); + my_error(ER_MISSING, MYF(0), table_name, "WITH SYSTEM VERSIONING"); return true; } @@ -6840,7 +6839,7 @@ bool Vers_parse_info::check_and_fix_implicit( if (orig_table && orig_table != f->field->orig_table) { err_different_tables: - my_error_as(ER_VERS_WRONG_PARAMS, ER_VERS_DIFFERENT_TABLES, MYF(0), table_name); + my_error(ER_VERS_DIFFERENT_TABLES, MYF(0), table_name); return true; } orig_table= f->field->orig_table; @@ -6901,7 +6900,7 @@ bool Vers_parse_info::check_and_fix_implicit( vers_cols == 0 && (plain_cols == 0 || !table_with_system_versioning)) { - my_error_as(ER_VERS_WRONG_PARAMS, ER_VERS_NO_COLS_DEFINED, MYF(0), + my_error(ER_VERS_NO_COLS_DEFINED, MYF(0), table_name, "WITH SYSTEM VERSIONING"); return true; } @@ -6960,7 +6959,7 @@ bool Vers_parse_info::check_and_fix_alter(THD *thd, Alter_info *alter_info, { if (!share->versioned) { - my_error_as(ER_VERS_WRONG_PARAMS, ER_VERS_NOT_VERSIONED, MYF(0), table_name); + my_error(ER_VERS_NOT_VERSIONED, MYF(0), table_name); return true; } @@ -7045,7 +7044,7 @@ bool Vers_parse_info::check_and_fix_alter(THD *thd, Alter_info *alter_info, if ((versioned_fields || unversioned_fields) && !share->versioned) { - my_error_as(ER_VERS_WRONG_PARAMS, ER_VERS_NOT_VERSIONED, MYF(0), table_name); + my_error(ER_VERS_NOT_VERSIONED, MYF(0), table_name); return true; } @@ -7175,7 +7174,7 @@ Vers_parse_info::fix_create_like(Alter_info &alter_info, HA_CREATE_INFO &create_ if (!f_start || !f_end) { - my_error_as(ER_VERS_WRONG_PARAMS, ER_MISSING, MYF(0), src_table.table_name, + my_error(ER_MISSING, MYF(0), src_table.table_name, f_start ? "AS ROW END" : "AS ROW START"); return true; } @@ -7192,28 +7191,27 @@ bool Vers_parse_info::check_with_conditions(const char *table_name) const { if (!as_row.start || !as_row.end) { - my_error_as(ER_VERS_WRONG_PARAMS, ER_MISSING, MYF(0), table_name, + my_error(ER_MISSING, MYF(0), table_name, as_row.start ? "AS ROW END" : "AS ROW START"); return true; } if (!system_time.start || !system_time.end) { - my_error_as(ER_VERS_WRONG_PARAMS, ER_MISSING, MYF(0), table_name, - "PERIOD FOR SYSTEM_TIME"); + my_error(ER_MISSING, MYF(0), table_name, "PERIOD FOR SYSTEM_TIME"); return true; } if (as_row.start != system_time.start) { - my_error_as(ER_VERS_WRONG_PARAMS, ER_MISMATCH, MYF(0), table_name, + my_error(ER_MISMATCH, MYF(0), table_name, "PERIOD FOR SYSTEM_TIME", "AS ROW START"); return true; } if (as_row.end != system_time.end) { - my_error_as(ER_VERS_WRONG_PARAMS, ER_MISMATCH, MYF(0), table_name, + my_error(ER_MISMATCH, MYF(0), table_name, "PERIOD FOR SYSTEM_TIME", "AS ROW END"); return true; } diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index cad877a13bd..2d1c5047664 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -7815,9 +7815,6 @@ ER_UPDATE_INFO_WITH_SYSTEM_VERSIONING ER_VERS_FIELD_WRONG_TYPE eng "%`s must be of type %`s for versioned table %`s" -ER_VERS_WRONG_PARAMS - eng "Wrong parameters %s" - ER_VERS_ENGINE_UNSUPPORTED eng "Engine does not support System Versioning for %`s" @@ -7873,22 +7870,22 @@ ER_NOT_ALLOWED eng "for %`s: not allowed '%s'" ER_VERS_DIFFERENT_TABLES - eng "for %`s: system fields selected from different tables" + eng "Wrong parameters for %`s: system fields selected from different tables" ER_VERS_NO_COLS_DEFINED - eng "for %`s: no columns defined '%s'" + eng "Wrong parameters for %`s: no columns defined '%s'" ER_VERS_NOT_VERSIONED - eng "for %`s: table is not versioned" + eng "Wrong parameters for %`s: table is not versioned" ER_MISSING - eng "for %`s: missing '%s'" + eng "Wrong parameters for %`s: missing '%s'" ER_MISMATCH - eng "for %`s: mismatch '%s' and '%s'" + eng "Wrong parameters for %`s: mismatch '%s' and '%s'" ER_PART_WRONG_VALUE - eng "for partitioned %`s: wrong value for '%s'" + eng "Wrong parameters for partitioned %`s: wrong value for '%s'" ER_VERS_WRONG_PARTS eng "Wrong partitions consistency for %`s: must have at least one 'VERSIONING' and exactly one last 'AS OF NOW'" diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 47400338a31..bc1faa6f813 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -5667,7 +5667,7 @@ opt_versioning_interval: if (get_interval_value($2, $3, &interval) || part_info->vers_set_interval(interval)) { - my_error_as(ER_VERS_WRONG_PARAMS, ER_PART_WRONG_VALUE, MYF(0), + my_error(ER_PART_WRONG_VALUE, MYF(0), Lex->create_last_non_select_table->table_name, "INTERVAL"); MYSQL_YYABORT; } @@ -5682,7 +5682,7 @@ opt_versioning_limit: DBUG_ASSERT(part_info->part_type == VERSIONING_PARTITION); if (part_info->vers_set_limit($2)) { - my_error_as(ER_VERS_WRONG_PARAMS, ER_PART_WRONG_VALUE, MYF(0), + my_error(ER_PART_WRONG_VALUE, MYF(0), Lex->create_last_non_select_table->table_name, "LIMIT"); MYSQL_YYABORT; }