Commit a3cc718c authored by unknown's avatar unknown

bug #15524 (partitioning range/list violation error message is insufficient)


include/my_base.h:
  HA_ERR_NO_PARTITION_FOUND added
mysql-test/r/partition_error.result:
  test result fixed
mysql-test/t/partition_error.test:
  test case added
sql/ha_partition.cc:
  now we launch the informative error message here
sql/share/errmsg.txt:
  Error message added
parent 1b74cbd9
......@@ -343,8 +343,9 @@ enum ha_base_keytype {
#define HA_ERR_NO_CONNECTION 157 /* Could not connect to storage engine */
#define HA_ERR_NULL_IN_SPATIAL 158 /* NULLs are not supported in spatial index */
#define HA_ERR_TABLE_DEF_CHANGED 159 /* The table changed in storage engine */
#define HA_ERR_NO_PARTITION_FOUND 160 /* There's no partition in table for given value */
#define HA_ERR_LAST 159 /*Copy last error nr.*/
#define HA_ERR_LAST 160 /*Copy last error nr.*/
/* Add error numbers before HA_ERR_LAST and change it accordingly. */
#define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1)
......
......@@ -544,3 +544,8 @@ partitions 2
partition x2 values in (5));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '4,
partition x2 values in (5))' at line 8
CREATE TABLE t1(a int)
PARTITION BY RANGE (a) (PARTITION p1 VALUES LESS THAN(5));
insert into t1 values (10);
ERROR HY000: Table has no partition for value 10
drop table t1;
......@@ -727,3 +727,11 @@ partitions 2
(partition x1 values in 4,
partition x2 values in (5));
#
# No partition for the given value
#
CREATE TABLE t1(a int)
PARTITION BY RANGE (a) (PARTITION p1 VALUES LESS THAN(5));
--error ER_NO_PARTITION_FOR_GIVEN_VALUE
insert into t1 values (10);
drop table t1;
......@@ -1174,7 +1174,7 @@ int ha_partition::write_row(byte * buf)
}
#endif
if (unlikely(error))
DBUG_RETURN(error);
DBUG_RETURN(HA_ERR_NO_PARTITION_FOUND);
m_last_part= part_id;
DBUG_PRINT("info", ("Insert in partition %d", part_id));
DBUG_RETURN(m_file[part_id]->write_row(buf));
......@@ -2973,7 +2973,11 @@ void ha_partition::print_error(int error, myf errflag)
DBUG_ENTER("ha_partition::print_error");
/* Should probably look for my own errors first */
/* monty: needs to be called for the last used partition ! */
m_file[0]->print_error(error, errflag);
if (error == HA_ERR_NO_PARTITION_FOUND)
my_error(ER_NO_PARTITION_FOR_GIVEN_VALUE, MYF(0),
m_part_info->part_expr->val_int());
else
m_file[0]->print_error(error, errflag);
DBUG_VOID_RETURN;
}
......
......@@ -5725,3 +5725,5 @@ ER_PLUGIN_IS_NOT_LOADED
eng "Plugin '%-.64s' is not loaded"
ER_WRONG_VALUE
eng "Incorrect %-.32s value: '%-.128s'"
ER_NO_PARTITION_FOR_GIVEN_VALUE
eng "Table has no partition for value %d"
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