Commit 35b679b9 authored by Sergei Golubchik's avatar Sergei Golubchik Committed by Aleksey Midenkov

SQL: error messages

remove unused error messages
reword ER_VERS_SYS_FIELD_NOT_HIDDEN->ER_VERS_SYS_FIELD_EXISTS
parent e6a74576
......@@ -392,12 +392,12 @@ period for system_time(sys_trx_start, sys_trx_end)
select * from t;
a
alter table t drop system versioning;
ERROR HY000: System versioning field `sys_trx_start` is not hidden
ERROR HY000: System versioning field `sys_trx_start` exists
alter table t drop column sys_trx_start;
select * from t;
a
alter table t drop system versioning;
ERROR HY000: System versioning field `sys_trx_end` is not hidden
ERROR HY000: System versioning field `sys_trx_end` exists
alter table t drop column sys_trx_end;
select * from t;
a
......
......@@ -290,7 +290,7 @@ insert into t1(x) values (1);
ERROR HY000: Temporal operation requires `mysql.transaction_registry` (@@system_versioning_transaction_registry).
set global system_versioning_transaction_registry= on;
Warnings:
Warning 4141 Transaction-based system versioning is EXPERIMENTAL and is subject to change in future.
Warning 4134 Transaction-based system versioning is EXPERIMENTAL and is subject to change in future.
create or replace table t1 (
x int,
y int as (x) virtual,
......
......@@ -14,7 +14,7 @@ alter table t drop system versioning, algorithm=inplace;
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Not implemented for system-versioned tables. Try ALGORITHM=COPY
set global system_versioning_transaction_registry=on;
Warnings:
Warning 4141 Transaction-based system versioning is EXPERIMENTAL and is subject to change in future.
Warning 4134 Transaction-based system versioning is EXPERIMENTAL and is subject to change in future.
create or replace table t (a int, b int) engine=innodb;
alter table t
add s bigint unsigned as row start,
......
......@@ -17,64 +17,64 @@ a b b+0
1 2 2
3 4 4
Warnings:
Note 4111 Non-versioned field `b` in historical query
Note 4111 Non-versioned field `b` in historical query
Note 4110 Non-versioned field `b` in historical query
Note 4110 Non-versioned field `b` in historical query
select * from t for system_time as of timestamp now(6);
a b
1 2
3 4
Warnings:
Note 4111 Non-versioned field `b` in historical query
Note 4110 Non-versioned field `b` in historical query
select count(*) from t for system_time as of timestamp now(6) group by b;
count(*)
1
1
Warnings:
Note 4111 Non-versioned field `b` in historical query
Note 4110 Non-versioned field `b` in historical query
select * from t for system_time as of timestamp now(6) order by b asc;
a b
1 2
3 4
Warnings:
Note 4111 Non-versioned field `b` in historical query
Note 4111 Non-versioned field `b` in historical query
Note 4110 Non-versioned field `b` in historical query
Note 4110 Non-versioned field `b` in historical query
select * from t for system_time as of timestamp now(6) order by b desc;
a b
3 4
1 2
Warnings:
Note 4111 Non-versioned field `b` in historical query
Note 4111 Non-versioned field `b` in historical query
Note 4110 Non-versioned field `b` in historical query
Note 4110 Non-versioned field `b` in historical query
select * from t for system_time as of timestamp now(6) group by a having a=2;
a b
Warnings:
Note 4111 Non-versioned field `b` in historical query
Note 4110 Non-versioned field `b` in historical query
select * from t for system_time as of timestamp now(6) group by b having b=2;
a b
1 2
Warnings:
Note 4111 Non-versioned field `b` in historical query
Note 4111 Non-versioned field `b` in historical query
Note 4111 Non-versioned field `b` in historical query
Note 4110 Non-versioned field `b` in historical query
Note 4110 Non-versioned field `b` in historical query
Note 4110 Non-versioned field `b` in historical query
select a from t for system_time as of timestamp now(6) where b=2;
a
1
Warnings:
Note 4111 Non-versioned field `b` in historical query
Note 4110 Non-versioned field `b` in historical query
select a from t for system_time as of timestamp now(6) where b=NULL;
a
Warnings:
Note 4111 Non-versioned field `b` in historical query
Note 4110 Non-versioned field `b` in historical query
select a from t for system_time as of timestamp now(6) where b is NULL;
a
Warnings:
Note 4111 Non-versioned field `b` in historical query
Note 4110 Non-versioned 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:
Note 4111 Non-versioned field `b` in historical query
Note 4111 Non-versioned field `b` in historical query
Note 4111 Non-versioned field `b` in historical query
Note 4110 Non-versioned field `b` in historical query
Note 4110 Non-versioned field `b` in historical query
Note 4110 Non-versioned field `b` in historical query
select a, b from t;
a b
1 2
......@@ -89,9 +89,9 @@ a b
1 2
3 4
Warnings:
Note 4111 Non-versioned field `b` in historical query
Note 4110 Non-versioned field `b` in historical query
select * from t for system_time as of timestamp now(6) where b is NULL;
a b
Warnings:
Note 4111 Non-versioned field `b` in historical query
Note 4110 Non-versioned field `b` in historical query
drop table t;
......@@ -89,7 +89,7 @@ ERROR HY000: Wrong partitions for `t1`: must have at least one HISTORY and exact
alter table t1 add partition (
partition p1 history);
Warnings:
Warning 4114 Maybe missing parameters: no rotation condition for multiple HISTORY partitions.
Warning 4113 Maybe missing parameters: no rotation condition for multiple HISTORY partitions.
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
......@@ -233,7 +233,7 @@ x
### warn about partition switching
delete from t1;
Warnings:
Note 4115 Versioned table `test`.`t1`: switching from partition `p0` to `p1`
Note 4114 Versioned table `test`.`t1`: switching from partition `p0` to `p1`
select * from t1 partition (p0);
x
1
......@@ -245,7 +245,7 @@ insert into t1 values (4), (5);
### warn about full partition
delete from t1;
Warnings:
Warning 4113 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
Warning 4112 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
select * from t1 partition (p1) order by x;
x
3
......@@ -259,7 +259,7 @@ alter table t1 partition by system_time limit 1 (
partition p1 history,
partition pn current);
Warnings:
Note 4113 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
Note 4112 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
## rotation by INTERVAL
create or replace table t1 (x int)
with system versioning
......@@ -289,7 +289,7 @@ x
insert into t1 values (4);
delete from t1;
Warnings:
Note 4115 Versioned table `test`.`t1`: switching from partition `p0` to `p1`
Note 4114 Versioned table `test`.`t1`: switching from partition `p0` to `p1`
select * from t1 partition (p1);
x
4
......@@ -315,8 +315,8 @@ x
### warn about partition switching and about full partition
delete from t1;
Warnings:
Note 4115 Versioned table `test`.`t1`: switching from partition `p0` to `p1`
Warning 4113 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
Note 4114 Versioned table `test`.`t1`: switching from partition `p0` to `p1`
Warning 4112 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
select * from t1 partition (p0sp0);
x
1
......@@ -400,13 +400,13 @@ partition p1 history,
partition p2 history,
partition pn current);
Warnings:
Note 4115 Versioned table `test`.`t1`: switching from partition `p1` to `p2`
Note 4114 Versioned table `test`.`t1`: switching from partition `p1` to `p2`
delete from t1 where x = 1;
Warnings:
Warning 4113 Versioned table `test`.`t1`: partition `p2` is full, add more HISTORY partitions
Warning 4112 Versioned table `test`.`t1`: partition `p2` is full, add more HISTORY partitions
delete from t1 where x = 2;
Warnings:
Warning 4113 Versioned table `test`.`t1`: partition `p2` is full, add more HISTORY partitions
Warning 4112 Versioned table `test`.`t1`: partition `p2` is full, add more HISTORY partitions
# Test cleanup
drop database test;
create database test;
......@@ -206,7 +206,8 @@ ERROR HY000: Table `t1` is not system-versioned
create or replace table t1 (x int) with system versioning;
insert into t1 values (1);
select * from t1 for system_time all for update;
ERROR HY000: Versioned SELECT write-locking of history rows
x
1
create or replace table t1 (a int not null auto_increment primary key) with system versioning;
select * from (t1 as t2 left join t1 as t3 using (a)) natural left join t1;
a
......
......@@ -259,8 +259,9 @@ select * from t1 for system_time all;
ERROR HY000: Table `t1` is not system-versioned
create or replace table t1 (x int) with system versioning;
insert into t1 values (1);
select * from t1 for system_time all for update;
ERROR HY000: Versioned SELECT write-locking of history rows
select * from t1 for system_time as of now() for update;
x
1
create or replace table t1 (a int not null auto_increment primary key) with system versioning;
select * from (t1 as t2 left join t1 as t3 using (a)) natural left join t1;
a
......
......@@ -10,7 +10,7 @@ period for system_time (sys_trx_start, sys_trx_end)
ERROR HY000: Temporal operation requires `mysql.transaction_registry` (@@system_versioning_transaction_registry).
set global system_versioning_transaction_registry= 1;
Warnings:
Warning 4141 Transaction-based system versioning is EXPERIMENTAL and is subject to change in future.
Warning 4134 Transaction-based system versioning is EXPERIMENTAL and is subject to change in future.
create or replace table t1 (
x int,
sys_trx_start bigint(20) unsigned as row start invisible,
......@@ -32,7 +32,7 @@ return if(cond = 1, '[CORRECT]', '[INCORRECT]');
set @@system_versioning_alter_history=keep;
set global system_versioning_transaction_registry=on;
Warnings:
Warning 4141 Transaction-based system versioning is EXPERIMENTAL and is subject to change in future.
Warning 4134 Transaction-based system versioning is EXPERIMENTAL and is subject to change in future.
create or replace table t1 (x int) engine innodb;
insert into t1 values (1);
alter table t1
......
......@@ -271,12 +271,12 @@ create or replace table t (
) with system versioning;
select * from t;
--error ER_VERS_SYS_FIELD_NOT_HIDDEN
--error ER_VERS_SYS_FIELD_EXISTS
alter table t drop system versioning;
alter table t drop column sys_trx_start;
select * from t;
--error ER_VERS_SYS_FIELD_NOT_HIDDEN
--error ER_VERS_SYS_FIELD_EXISTS
alter table t drop system versioning;
alter table t drop column sys_trx_end;
select * from t;
......
......@@ -122,7 +122,6 @@ select * from t1 for system_time all;
create or replace table t1 (x int) with system versioning;
insert into t1 values (1);
--error ER_VERS_HISTORY_LOCK
select * from t1 for system_time all for update;
create or replace table t1 (a int not null auto_increment primary key) with system versioning;
......
......@@ -149,8 +149,7 @@ select * from t1 for system_time all;
create or replace table t1 (x int) with system versioning;
insert into t1 values (1);
--error ER_VERS_HISTORY_LOCK
select * from t1 for system_time all for update;
select * from t1 for system_time as of now() for update;
create or replace table t1 (a int not null auto_increment primary key) with system versioning;
select * from (t1 as t2 left join t1 as t3 using (a)) natural left join t1;
......
......@@ -7199,13 +7199,13 @@ bool Vers_parse_info::fix_alter_info(THD *thd, Alter_info *alter_info,
if (share->vers_start_field()->invisible < INVISIBLE_SYSTEM)
{
my_error(ER_VERS_SYS_FIELD_NOT_HIDDEN, MYF(0),
my_error(ER_VERS_SYS_FIELD_EXISTS, MYF(0),
share->vers_start_field()->field_name.str);
return true;
}
if (share->vers_end_field()->invisible < INVISIBLE_SYSTEM)
{
my_error(ER_VERS_SYS_FIELD_NOT_HIDDEN, MYF(0),
my_error(ER_VERS_SYS_FIELD_EXISTS, MYF(0),
share->vers_end_field()->field_name.str);
return true;
}
......
......@@ -7825,9 +7825,6 @@ ER_VERS_FIELD_WRONG_TYPE
ER_VERS_ENGINE_UNSUPPORTED
eng "Transaction system versioning for %`s is not supported"
ER_VERS_RANGE_UNITS_MISMATCH
eng "Range units mismatch"
ER_NON_VERSIONED_FIELD_IN_HISTORICAL_QUERY
eng "Non-versioned field %`s in historical query"
......@@ -7858,21 +7855,9 @@ ER_VERS_ALTER_ENGINE_PROHIBITED
ER_VERS_RANGE_PROHIBITED
eng "SYSTEM_TIME range selector is prohibited"
ER_VERS_VIEW_PROHIBITED
eng "Creating VIEW %`s is prohibited!"
ER_VERS_UNUSED_CLAUSE
eng "Unused clause: '%s'"
WARN_VERS_ALIAS_TOO_LONG
eng "Auto generated alias for %`s.%`s is too long; using %`s"
ER_VERS_VTMD_ERROR
eng "VTMD error: %s"
ER_VERS_DIFFERENT_TABLES
eng "Wrong parameters for %`s: system fields selected from different tables"
ER_VERS_TABLE_MUST_HAVE_COLUMNS
eng "Table %`s must have at least one versioned column"
......@@ -7891,20 +7876,14 @@ ER_PART_WRONG_VALUE
ER_VERS_WRONG_PARTS
eng "Wrong partitions for %`s: must have at least one HISTORY and exactly one last CURRENT"
ER_VERS_HISTORY_LOCK
eng "Versioned SELECT write-locking of history rows"
ER_VERS_NO_TRX_ID
eng "TRX_ID %lu not found in `mysql.transaction_registry`"
ER_WRONG_TABLESPACE_NAME 42000
eng "Incorrect tablespace name %`s"
ER_VERS_ALTER_SYSTEM_FIELD
eng "Can not change system versioning field %`s"
ER_VERS_SYS_FIELD_NOT_HIDDEN
eng "System versioning field %`s is not hidden"
ER_VERS_SYS_FIELD_EXISTS
eng "System versioning field %`s exists"
ER_NOT_LOG_TABLE
eng "Table %`s.%`s is not a log table"
......
......@@ -8433,51 +8433,4 @@ uint get_partition_field_store_length(Field *field)
return store_length;
}
// FIXME: duplicate of ha_partition::set_up_table_before_create
bool set_up_table_before_create(THD *thd,
TABLE_SHARE *share,
const char *partition_name_with_path,
HA_CREATE_INFO *info,
partition_element *part_elem)
{
bool error= false;
const char *partition_name;
DBUG_ENTER("set_up_table_before_create");
DBUG_ASSERT(part_elem);
if (!part_elem)
DBUG_RETURN(true);
share->max_rows= part_elem->part_max_rows;
share->min_rows= part_elem->part_min_rows;
partition_name= strrchr(partition_name_with_path, FN_LIBCHAR);
if ((part_elem->index_file_name &&
(error= append_file_to_dir(thd,
const_cast<const char**>(&part_elem->index_file_name),
partition_name+1))) ||
(part_elem->data_file_name &&
(error= append_file_to_dir(thd,
const_cast<const char**>(&part_elem->data_file_name),
partition_name+1))))
{
DBUG_RETURN(error);
}
if (part_elem->index_file_name != NULL)
{
info->index_file_name= part_elem->index_file_name;
}
if (part_elem->data_file_name != NULL)
{
info->data_file_name= part_elem->data_file_name;
}
if (part_elem->tablespace_name != NULL)
{
if (check_tablespace_name(part_elem->tablespace_name) != IDENT_NAME_OK)
{
DBUG_RETURN(true);
}
info->tablespace= part_elem->tablespace_name;
}
DBUG_RETURN(error);
}
#endif
......@@ -836,24 +836,11 @@ int SELECT_LEX::vers_setup_conds(THD *thd, TABLE_LIST *tables, COND **where_expr
if (vers_conditions)
{
switch (this->lock_type)
{
case TL_WRITE_ALLOW_WRITE:
case TL_WRITE_CONCURRENT_INSERT:
case TL_WRITE_DELAYED:
case TL_WRITE_DEFAULT:
case TL_WRITE_LOW_PRIORITY:
case TL_WRITE:
case TL_WRITE_ONLY:
my_error(ER_VERS_HISTORY_LOCK, MYF(0));
DBUG_RETURN(-1);
default:
break;
}
if (vers_conditions == SYSTEM_TIME_ALL)
continue;
} // if (vers_conditions)
lock_type= TL_READ; // ignore TL_WRITE, history is immutable anyway
}
if (table->on_expr)
{
......
......@@ -22,70 +22,6 @@
#include "sql_table.h" // write_bin_log
#include "sql_class.h" // THD
/**
Check if tablespace name is valid
@param tablespace_name Name of the tablespace
@note Tablespace names are not reflected in the file system, so
character case conversion or consideration is not relevant.
@note Checking for path characters or ending space is not done.
The only checks are for identifier length, both in terms of
number of characters and number of bytes.
@retval IDENT_NAME_OK Identifier name is ok (Success)
@retval IDENT_NAME_WRONG Identifier name is wrong, if length == 0
* (ER_WRONG_TABLESPACE_NAME)
@retval IDENT_NAME_TOO_LONG Identifier name is too long if it is greater
than 64 characters (ER_TOO_LONG_IDENT)
@note In case of IDENT_NAME_TOO_LONG or IDENT_NAME_WRONG, the function
reports an error (using my_error()).
*/
enum_ident_name_check check_tablespace_name(const char *tablespace_name)
{
size_t name_length= 0; //< Length as number of bytes
size_t name_length_symbols= 0; //< Length as number of symbols
// Name must be != NULL and length must be > 0
if (!tablespace_name || (name_length= strlen(tablespace_name)) == 0)
{
my_error(ER_WRONG_TABLESPACE_NAME, MYF(0), tablespace_name);
return IDENT_NAME_WRONG;
}
// If we do not have too many bytes, we must check the number of symbols,
// provided the system character set may use more than one byte per symbol.
if (name_length <= NAME_LEN && use_mb(system_charset_info))
{
const char *name= tablespace_name; //< The actual tablespace name
const char *end= name + name_length; //< Pointer to first byte after name
// Loop over all symbols as long as we don't have too many already
while (name != end && name_length_symbols <= NAME_CHAR_LEN)
{
int len= my_ismbchar(system_charset_info, name, end);
if (len)
name += len;
else
name++;
name_length_symbols++;
}
}
if (name_length_symbols > NAME_CHAR_LEN || name_length > NAME_LEN)
{
my_error(ER_TOO_LONG_IDENT, MYF(0), tablespace_name);
return IDENT_NAME_TOO_LONG;
}
return IDENT_NAME_OK;
}
int mysql_alter_tablespace(THD *thd, st_alter_tablespace *ts_info)
{
int error= HA_ADMIN_NOT_IMPLEMENTED;
......
......@@ -19,41 +19,6 @@
class THD;
class st_alter_tablespace;
/**
Enumerate possible status of a identifier name while determining
its validity
*/
enum enum_ident_name_check
{
IDENT_NAME_OK,
IDENT_NAME_WRONG,
IDENT_NAME_TOO_LONG
};
/**
Check if tablespace name is valid
@param tablespace_name Name of the tablespace
@note Tablespace names are not reflected in the file system, so
character case conversion or consideration is not relevant.
@note Checking for path characters or ending space is not done.
The only checks are for identifier length, both in terms of
number of characters and number of bytes.
@retval IDENT_NAME_OK Identifier name is ok (Success)
@retval IDENT_NAME_WRONG Identifier name is wrong, if length == 0
(ER_WRONG_TABLESPACE_NAME)
@retval IDENT_NAME_TOO_LONG Identifier name is too long if it is greater
than 64 characters (ER_TOO_LONG_IDENT)
@note In case of IDENT_NAME_TOO_LONG or IDENT_NAME_WRONG, the function
reports an error (using my_error()).
*/
enum_ident_name_check check_tablespace_name(const char *tablespace_name);
int mysql_alter_tablespace(THD* thd, st_alter_tablespace *ts_info);
#endif /* SQL_TABLESPACE_INCLUDED */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment