Below is the list of changes that have just been committed into a local
5.0 repository of kgeorge. When kgeorge does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-05-30 09:55:38+03:00, gkodinov@stripped +8 -0
Bug #28492: subselect returns LONG in >5.0.24a and LONGLONG in <=5.0.24a
Integer values with 10 digits may or may not fit into an int column
(e.g. 2147483647 vs 6147483647).
Thus when creating a temp table column for such an int we must
use bigint instead.
Fixed to use bigint.
Also subsituted a "magic number" with a named constant.
mysql-test/r/analyse.result@stripped, 2007-05-30 09:55:36+03:00, gkodinov@stripped +12 -12
Bug #28492: Adjusted the results after having fixed the bug
mysql-test/r/metadata.result@stripped, 2007-05-30 09:55:36+03:00, gkodinov@stripped +11 -0
Bug #28492: test case
mysql-test/r/olap.result@stripped, 2007-05-30 09:55:36+03:00, gkodinov@stripped +2 -2
Bug #28492: Adjusted the results after having fixed the bug
mysql-test/r/sp.result@stripped, 2007-05-30 09:55:36+03:00, gkodinov@stripped +1 -1
Bug #28492: Adjusted the results after having fixed the bug
mysql-test/r/view.result@stripped, 2007-05-30 09:55:36+03:00, gkodinov@stripped +1 -1
Bug #28492: Adjusted the results after having fixed the bug
mysql-test/t/metadata.test@stripped, 2007-05-30 09:55:36+03:00, gkodinov@stripped +11 -0
Bug #28492: test case
sql/field.h@stripped, 2007-05-30 09:55:36+03:00, gkodinov@stripped +1 -1
Bug #28492: Replaced a magic number with a constant
sql/sql_select.cc@stripped, 2007-05-30 09:55:36+03:00, gkodinov@stripped +7 -2
Bug #28492: Treat integers with 10 and more digits as
bigint.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: gkodinov
# Host: magare.gmz
# Root: /home/kgeorge/mysql/work/B28492-5.0-opt
--- 1.203/sql/field.h 2007-05-28 01:05:33 +03:00
+++ 1.204/sql/field.h 2007-05-30 09:55:36 +03:00
@@ -675,7 +675,7 @@ public:
void sort_string(char *buff,uint length);
uint32 pack_length() const { return 4; }
void sql_type(String &str) const;
- uint32 max_display_length() { return 11; }
+ uint32 max_display_length() { return MY_INT32_NUM_DECIMAL_DIGITS; }
};
--- 1.526/sql/sql_select.cc 2007-05-26 23:19:34 +03:00
+++ 1.527/sql/sql_select.cc 2007-05-30 09:55:36 +03:00
@@ -8869,8 +8869,13 @@ static Field *create_tmp_field_from_item
item->name, table, item->decimals, TRUE);
break;
case INT_RESULT:
- /* Select an integer type with the minimal fit precision */
- if (item->max_length > MY_INT32_NUM_DECIMAL_DIGITS)
+ /*
+ Select an integer type with the minimal fit precision.
+ MY_INT32_NUM_DECIMAL_DIGITS is sign inclusive, don't consider the sign.
+ Values with MY_INT32_NUM_DECIMAL_DIGITS digits may or may not fit into
+ Field_long : make them Field_longlong.
+ */
+ if (item->max_length >= (MY_INT32_NUM_DECIMAL_DIGITS - 1))
new_field=new Field_longlong(item->max_length, maybe_null,
item->name, table, item->unsigned_flag);
else
--- 1.38/mysql-test/r/olap.result 2007-04-30 06:14:30 +03:00
+++ 1.39/mysql-test/r/olap.result 2007-05-30 09:55:36 +03:00
@@ -696,8 +696,8 @@ CREATE VIEW v1 AS
SELECT a, LENGTH(a), COUNT(*) FROM t1 GROUP BY a WITH ROLLUP;
DESC v1;
Field Type Null Key Default Extra
-a int(11) YES 0
-LENGTH(a) int(10) YES NULL
+a bigint(11) YES NULL
+LENGTH(a) bigint(10) YES NULL
COUNT(*) bigint(21) NO 0
SELECT * FROM v1;
a LENGTH(a) COUNT(*)
--- 1.201/mysql-test/r/view.result 2007-05-24 05:04:09 +03:00
+++ 1.202/mysql-test/r/view.result 2007-05-30 09:55:36 +03:00
@@ -2779,7 +2779,7 @@ CREATE TABLE t1 (i int, j int);
CREATE VIEW v1 AS SELECT COALESCE(i,j) FROM t1;
DESCRIBE v1;
Field Type Null Key Default Extra
-COALESCE(i,j) int(11) YES NULL
+COALESCE(i,j) bigint(11) YES NULL
CREATE TABLE t2 SELECT COALESCE(i,j) FROM t1;
DESCRIBE t2;
Field Type Null Key Default Extra
--- 1.27/mysql-test/r/analyse.result 2006-09-28 21:30:45 +03:00
+++ 1.28/mysql-test/r/analyse.result 2007-05-30 09:55:36 +03:00
@@ -39,10 +39,10 @@ t2 CREATE TABLE `t2` (
`Field_name` varbinary(255) NOT NULL default '',
`Min_value` varbinary(255) default NULL,
`Max_value` varbinary(255) default NULL,
- `Min_length` int(11) NOT NULL default '0',
- `Max_length` int(11) NOT NULL default '0',
- `Empties_or_zeros` int(11) NOT NULL default '0',
- `Nulls` int(11) NOT NULL default '0',
+ `Min_length` bigint(11) NOT NULL default '0',
+ `Max_length` bigint(11) NOT NULL default '0',
+ `Empties_or_zeros` bigint(11) NOT NULL default '0',
+ `Nulls` bigint(11) NOT NULL default '0',
`Avg_value_or_avg_length` varbinary(255) NOT NULL default '',
`Std` varbinary(255) default NULL,
`Optimal_fieldtype` varbinary(64) NOT NULL default ''
@@ -58,10 +58,10 @@ t2 CREATE TABLE `t2` (
`Field_name` varbinary(255) NOT NULL default '',
`Min_value` varbinary(255) default NULL,
`Max_value` varbinary(255) default NULL,
- `Min_length` int(11) NOT NULL default '0',
- `Max_length` int(11) NOT NULL default '0',
- `Empties_or_zeros` int(11) NOT NULL default '0',
- `Nulls` int(11) NOT NULL default '0',
+ `Min_length` bigint(11) NOT NULL default '0',
+ `Max_length` bigint(11) NOT NULL default '0',
+ `Empties_or_zeros` bigint(11) NOT NULL default '0',
+ `Nulls` bigint(11) NOT NULL default '0',
`Avg_value_or_avg_length` varbinary(255) NOT NULL default '',
`Std` varbinary(255) default NULL,
`Optimal_fieldtype` varbinary(64) NOT NULL default ''
@@ -81,10 +81,10 @@ t2 CREATE TABLE `t2` (
`Field_name` varbinary(255) NOT NULL default '',
`Min_value` varbinary(255) default NULL,
`Max_value` varbinary(255) default NULL,
- `Min_length` int(11) NOT NULL default '0',
- `Max_length` int(11) NOT NULL default '0',
- `Empties_or_zeros` int(11) NOT NULL default '0',
- `Nulls` int(11) NOT NULL default '0',
+ `Min_length` bigint(11) NOT NULL default '0',
+ `Max_length` bigint(11) NOT NULL default '0',
+ `Empties_or_zeros` bigint(11) NOT NULL default '0',
+ `Nulls` bigint(11) NOT NULL default '0',
`Avg_value_or_avg_length` varbinary(255) NOT NULL default '',
`Std` varbinary(255) default NULL,
`Optimal_fieldtype` varbinary(64) NOT NULL default ''
--- 1.15/mysql-test/r/metadata.result 2006-11-09 16:55:34 +02:00
+++ 1.16/mysql-test/r/metadata.result 2007-05-30 09:55:36 +03:00
@@ -130,3 +130,14 @@ def v3 renamed 8 12 0 Y 32896 0 63
renamed
drop table t1;
drop view v1,v2,v3;
+select a.* from (select 2147483648 as v_large) a;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def a v_large v_large 8 10 10 N 32769 0 63
+v_large
+2147483648
+select a.* from (select 214748364 as v_small) a;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def a v_small v_small 3 9 9 N 32769 0 63
+v_small
+214748364
+End of 5.0 tests
--- 1.6/mysql-test/t/metadata.test 2006-11-09 16:55:35 +02:00
+++ 1.7/mysql-test/t/metadata.test 2007-05-30 09:55:36 +03:00
@@ -81,3 +81,14 @@ drop view v1,v2,v3;
--disable_metadata
# End of 4.1 tests
+
+#
+# Bug #28492: subselect returns LONG in >5.0.24a and LONGLONG in <=5.0.24a
+#
+--enable_metadata
+select a.* from (select 2147483648 as v_large) a;
+select a.* from (select 214748364 as v_small) a;
+--disable_metadata
+
+
+--echo End of 5.0 tests
--- 1.227/mysql-test/r/sp.result 2007-04-28 02:14:22 +03:00
+++ 1.228/mysql-test/r/sp.result 2007-05-30 09:55:36 +03:00
@@ -4909,7 +4909,7 @@ create table t3 as select * from v1|
show create table t3|
Table Create Table
t3 CREATE TABLE `t3` (
- `j` int(11) default NULL
+ `j` bigint(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t3|
j
| Thread |
|---|
| • bk commit into 5.0 tree (gkodinov:1.2504) BUG#28492 | kgeorge | 30 May |