summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <holyfoot@deer.(none)>2005-12-15 16:20:56 +0400
committerunknown <holyfoot@deer.(none)>2005-12-15 16:20:56 +0400
commita3cc718cc4d068f3104e15ecbc350dad6f958db5 (patch)
tree781d8529af90da18115fb0a92cb5ea0f38f6dc72
parent1b74cbd9d6817c0210904e0b324acbe61554e094 (diff)
downloadmariadb-git-a3cc718cc4d068f3104e15ecbc350dad6f958db5.tar.gz
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
-rw-r--r--include/my_base.h3
-rw-r--r--mysql-test/r/partition_error.result5
-rw-r--r--mysql-test/t/partition_error.test8
-rw-r--r--sql/ha_partition.cc8
-rw-r--r--sql/share/errmsg.txt2
5 files changed, 23 insertions, 3 deletions
diff --git a/include/my_base.h b/include/my_base.h
index c688591e1d5..5ea3795f715 100644
--- a/include/my_base.h
+++ b/include/my_base.h
@@ -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)
diff --git a/mysql-test/r/partition_error.result b/mysql-test/r/partition_error.result
index 58c42888ae7..90faa3b20b8 100644
--- a/mysql-test/r/partition_error.result
+++ b/mysql-test/r/partition_error.result
@@ -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;
diff --git a/mysql-test/t/partition_error.test b/mysql-test/t/partition_error.test
index b4851dcf8c0..ea12bbc5207 100644
--- a/mysql-test/t/partition_error.test
+++ b/mysql-test/t/partition_error.test
@@ -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;
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 650830832cb..b0b4ac3fdcd 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -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;
}
diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt
index d6be0405865..35b6b17efa4 100644
--- a/sql/share/errmsg.txt
+++ b/sql/share/errmsg.txt
@@ -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"