Commit 7974a14d authored by unknown's avatar unknown

Merge stella.local:/home2/mydev/mysql-5.1-ateam

into  stella.local:/home2/mydev/mysql-5.1-axmrg
parents fc4e4ea5 6d1e750d
......@@ -1307,4 +1307,51 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
ALTER TABLE t1 ANALYZE PARTITION p1 EXTENDED;
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 'EXTENDED' at line 1
DROP TABLE t1;
CREATE TABLE t1 (s1 BIGINT UNSIGNED)
PARTITION BY RANGE (s1) (
PARTITION p0 VALUES LESS THAN (0),
PARTITION p1 VALUES LESS THAN (1),
PARTITION p2 VALUES LESS THAN (18446744073709551615)
);
INSERT INTO t1 VALUES (0), (18446744073709551614);
INSERT INTO t1 VALUES (18446744073709551615);
ERROR HY000: Table has no partition for value 18446744073709551615
DROP TABLE t1;
CREATE TABLE t1 (s1 BIGINT UNSIGNED)
PARTITION BY RANGE (s1) (
PARTITION p0 VALUES LESS THAN (0),
PARTITION p1 VALUES LESS THAN (1),
PARTITION p2 VALUES LESS THAN (18446744073709551614),
PARTITION p3 VALUES LESS THAN MAXVALUE
);
INSERT INTO t1 VALUES (-1), (0), (18446744073709551613),
(18446744073709551614), (18446744073709551615);
Warnings:
Warning 1264 Out of range value for column 's1' at row 1
SELECT * FROM t1;
s1
0
0
18446744073709551613
18446744073709551614
18446744073709551615
SELECT * FROM t1 WHERE s1 = 0;
s1
0
0
SELECT * FROM t1 WHERE s1 = 18446744073709551614;
s1
18446744073709551614
SELECT * FROM t1 WHERE s1 = 18446744073709551615;
s1
18446744073709551615
DROP TABLE t1;
CREATE TABLE t1 (s1 BIGINT UNSIGNED)
PARTITION BY RANGE (s1) (
PARTITION p0 VALUES LESS THAN (0),
PARTITION p1 VALUES LESS THAN (1),
PARTITION p2 VALUES LESS THAN (18446744073709551615),
PARTITION p3 VALUES LESS THAN MAXVALUE
);
DROP TABLE t1;
End of 5.1 tests
......@@ -1556,4 +1556,42 @@ ALTER TABLE t1 OPTIMIZE PARTITION p1 EXTENDED;
ALTER TABLE t1 ANALYZE PARTITION p1 EXTENDED;
DROP TABLE t1;
#
# Bug #29258: Partitions: search fails for maximum unsigned bigint
#
CREATE TABLE t1 (s1 BIGINT UNSIGNED)
PARTITION BY RANGE (s1) (
PARTITION p0 VALUES LESS THAN (0),
PARTITION p1 VALUES LESS THAN (1),
PARTITION p2 VALUES LESS THAN (18446744073709551615)
);
INSERT INTO t1 VALUES (0), (18446744073709551614);
--error ER_NO_PARTITION_FOR_GIVEN_VALUE
INSERT INTO t1 VALUES (18446744073709551615);
DROP TABLE t1;
CREATE TABLE t1 (s1 BIGINT UNSIGNED)
PARTITION BY RANGE (s1) (
PARTITION p0 VALUES LESS THAN (0),
PARTITION p1 VALUES LESS THAN (1),
PARTITION p2 VALUES LESS THAN (18446744073709551614),
PARTITION p3 VALUES LESS THAN MAXVALUE
);
INSERT INTO t1 VALUES (-1), (0), (18446744073709551613),
(18446744073709551614), (18446744073709551615);
SELECT * FROM t1;
SELECT * FROM t1 WHERE s1 = 0;
SELECT * FROM t1 WHERE s1 = 18446744073709551614;
SELECT * FROM t1 WHERE s1 = 18446744073709551615;
DROP TABLE t1;
CREATE TABLE t1 (s1 BIGINT UNSIGNED)
PARTITION BY RANGE (s1) (
PARTITION p0 VALUES LESS THAN (0),
PARTITION p1 VALUES LESS THAN (1),
PARTITION p2 VALUES LESS THAN (18446744073709551615),
PARTITION p3 VALUES LESS THAN MAXVALUE
);
DROP TABLE t1;
--echo End of 5.1 tests
......@@ -524,6 +524,13 @@ bool partition_info::check_range_constants()
current_largest= part_range_value;
range_int_array[i]= part_range_value;
}
else if (defined_max_value &&
current_largest == part_range_value &&
part_range_value == LONGLONG_MAX &&
i == (no_parts - 1))
{
range_int_array[i]= part_range_value;
}
else
{
my_error(ER_RANGE_NOT_INCREASING_ERROR, MYF(0));
......
......@@ -2834,8 +2834,8 @@ int get_partition_id_range(partition_info *part_info,
loc_part_id++;
*part_id= (uint32)loc_part_id;
if (loc_part_id == max_partition &&
range_array[loc_part_id] != LONGLONG_MAX &&
part_func_value >= range_array[loc_part_id])
part_func_value >= range_array[loc_part_id] &&
!part_info->defined_max_value)
DBUG_RETURN(HA_ERR_NO_PARTITION_FOUND);
DBUG_PRINT("exit",("partition: %d", *part_id));
......@@ -2941,7 +2941,13 @@ uint32 get_partition_id_range_for_endpoint(partition_info *part_info,
}
if (left_endpoint)
{
if (part_func_value >= range_array[loc_part_id])
longlong bound= range_array[loc_part_id];
/*
In case of PARTITION p VALUES LESS THAN MAXVALUE
the maximum value is in the current partition.
*/
if (part_func_value > bound ||
(part_func_value == bound && !part_info->defined_max_value))
loc_part_id++;
}
else
......
......@@ -472,14 +472,6 @@ int ha_tina::encode_quote(uchar *buf)
const char *ptr;
const char *end_ptr;
const bool was_null= (*field)->is_null();
/*
CSV does not support nulls. ::create() prevents creation of a table
with nullable columns so if we encounter them here, there is a bug.
This may only occur if the frm was created by an older version of
mysqld which permitted table creation with nullable columns.
*/
DBUG_ASSERT(!(*field)->maybe_null());
/*
assistance for backwards compatibility in production builds.
......
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