summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2005-11-23 17:05:59 -0800
committerunknown <jimw@mysql.com>2005-11-23 17:05:59 -0800
commite3028f300687ddbc00c67dc507e462e1c4a61f0e (patch)
tree37b1928ae9c2e0b1e99023cac74615699a56b3d2
parent1a5218a0630d1489f2d226b6a417962dd2e12565 (diff)
downloadmariadb-git-e3028f300687ddbc00c67dc507e462e1c4a61f0e.tar.gz
Fix handling of maximum value for MAX_ROWS on 64-bit platforms. (Bug #14155)
mysql-test/r/create.result: Add new results mysql-test/t/create.test: Add regression test sql/table.cc: To cap a value at 2^32-1 on a 64-bit platform, use UINT_MAX32, not ~(ulong)0, since a ulong may be 64-bit itself.
-rw-r--r--mysql-test/r/create.result19
-rw-r--r--mysql-test/t/create.test14
-rw-r--r--sql/table.cc8
3 files changed, 37 insertions, 4 deletions
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index 6edd4cbc48f..80a3c2ea82d 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -621,3 +621,22 @@ create table if not exists t1 (a int);
Warnings:
Note 1050 Table 't1' already exists
drop table t1;
+create table t1 (i int) engine=myisam max_rows=100000000000;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 MAX_ROWS=4294967295
+alter table t1 max_rows=100;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 MAX_ROWS=100
+alter table t1 max_rows=100000000000;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 MAX_ROWS=4294967295
+drop table t1;
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index 73184853d1a..50a2e1a3cba 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -527,3 +527,17 @@ create table if not exists t1 (a int);
drop table t1;
# End of 4.1 tests
+
+#
+# Bug #14155: Maximum value of MAX_ROWS handled incorrectly on 64-bit
+# platforms
+#
+create table t1 (i int) engine=myisam max_rows=100000000000;
+show create table t1;
+alter table t1 max_rows=100;
+show create table t1;
+alter table t1 max_rows=100000000000;
+show create table t1;
+drop table t1;
+
+# End of 5.0 tests
diff --git a/sql/table.cc b/sql/table.cc
index 04d1a95cd9b..eb8cbf9b5e2 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -1253,10 +1253,10 @@ File create_frm(register my_string name, const char *db, const char *table,
#if SIZEOF_OFF_T > 4
/* Fix this when we have new .frm files; Current limit is 4G rows (QQ) */
- if (create_info->max_rows > ~(ulong) 0)
- create_info->max_rows= ~(ulong) 0;
- if (create_info->min_rows > ~(ulong) 0)
- create_info->min_rows= ~(ulong) 0;
+ if (create_info->max_rows > UINT_MAX32)
+ create_info->max_rows= UINT_MAX32;
+ if (create_info->min_rows > UINT_MAX32)
+ create_info->min_rows= UINT_MAX32;
#endif
/*
Ensure that raid_chunks can't be larger than 255, as this would cause