|
|||||||||||
|
bk commit into 5.1 tree (anozdrin:1.2619) BUG#20550
From: Alexander Nozdrin <alik(at)mysql.com>
Date: Fri Oct 05 2007 - 08:35:06 EDT
ChangeSet@1.2619, 2007-10-05 16:35:01+04:00, anozdrin@station. +4 -0 Fix for BUG#20550: Stored function: wrong RETURN type metadata when used in a VIEW. The problem was that wrong function (create_tmp_from_item()) was used to create a temporary field for Item_func_sp. The fix is to use create_tmp_from_field(). mysql-test/r/sp.result@1.293, 2007-10-05 16:34:58+04:00, anozdrin@station. +49 -1 Update result file. mysql-test/t/sp.test@1.257, 2007-10-05 16:34:58+04:00, anozdrin@station. +84 -0 Add a test case for BUG#20550. sql/item_func.h@1.168, 2007-10-05 16:34:58+04:00, anozdrin@station. +5 -0 Add a getter for Item_func_sp::sp_result_field. sql/sql_select.cc@1.557, 2007-10-05 16:34:58+04:00, anozdrin@station. +30 -0 Use create_tmp_from_field() to create a temporary field for Item_func_sp. diff -Nrup a/mysql-test/r/sp.result b/mysql-test/r/sp.result --- a/mysql-test/r/sp.result 2007-09-05 22:02:59 +04:00@@ -4914,7 +4914,7 @@ create table t3 as select * from v1| show create table t3| Table Create Table t3 CREATE TABLE `t3` ( - `j` bigint(11) DEFAULT NULL + `j` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 select * from t3| j @@ -6599,3 +6599,51 @@ DROP TABLE t1; DROP PROCEDURE p1; DROP PROCEDURE p2; End of 5.0 tests + +# +# Bug#20550. +# + +# +# - Prepare. +# + +DROP VIEW IF EXISTS v1; +DROP VIEW IF EXISTS v2; +DROP FUNCTION IF EXISTS f1; +DROP FUNCTION IF EXISTS f2; + +# +# - Create required objects. +# + +CREATE FUNCTION f1() RETURNS VARCHAR(65525) RETURN 'Hello'; + +CREATE FUNCTION f2() RETURNS TINYINT RETURN 1; + +CREATE VIEW v1 AS SELECT f1(); + +CREATE VIEW v2 AS SELECT f2(); + +# +# - Check. +# + +SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'v1'; +DATA_TYPE +varchar + +SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'v2'; +DATA_TYPE +tinyint + +# +# - Cleanup. +# + +DROP FUNCTION f1; +DROP FUNCTION f2; +DROP VIEW v1; +DROP VIEW v2; + +End of 5.1 tests diff -Nrup a/mysql-test/t/sp.test b/mysql-test/t/sp.test --- a/mysql-test/t/sp.test 2007-09-05 22:02:59 +04:00@@ -7549,3 +7549,87 @@ DROP PROCEDURE p1; DROP PROCEDURE p2;
--echo End of 5.0 tests
--- a/sql/item_func.h 2007-07-21 23:46:50 +04:00@@ -1535,6 +1535,11 @@ public:
bool fix_fields(THD *thd, Item **ref);
void fix_length_and_dec(void);
diff -Nrup a/sql/sql_select.cc b/sql/sql_select.cc --- a/sql/sql_select.cc 2007-08-28 04:33:54 +04:00@@ -9301,6 +9301,36 @@ Field *create_tmp_field(THD *thd, TABLE
}
case Item::COND_ITEM: case Item::FIELD_AVG_ITEM: case Item::FIELD_STD_ITEM: -- MySQL Code Commits Mailing List For list archives: http://lists.mysql.com/commits To unsubscribe: http://lists.mysql.com/commits?unsub=lists@pantek.comReceived on Fri Oct 5 08:34:57 2007 This archive was generated by hypermail 2.1.8 : Sun Oct 07 2007 - 09:58:13 EDT |
||||||||||
|
|||||||||||