summaryrefslogtreecommitdiff
path: root/mysql-test/t/sp.test
diff options
context:
space:
mode:
authorunknown <anozdrin/alik@station.>2007-10-05 16:35:01 +0400
committerunknown <anozdrin/alik@station.>2007-10-05 16:35:01 +0400
commitc215e78d1607a9afc55df3df3d5499d283ffed63 (patch)
treec2cb139377c0c573cd55e57158ba3f61abedffce /mysql-test/t/sp.test
parent11476cfc042a316399efbd59016a9898390f0f6b (diff)
downloadmariadb-git-c215e78d1607a9afc55df3df3d5499d283ffed63.tar.gz
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: Update result file. mysql-test/t/sp.test: Add a test case for BUG#20550. sql/item_func.h: Add a getter for Item_func_sp::sp_result_field. sql/sql_select.cc: Use create_tmp_from_field() to create a temporary field for Item_func_sp.
Diffstat (limited to 'mysql-test/t/sp.test')
-rw-r--r--mysql-test/t/sp.test84
1 files changed, 84 insertions, 0 deletions
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 27e559f4463..938bbc27777 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -7549,3 +7549,87 @@ DROP PROCEDURE p1;
DROP PROCEDURE p2;
--echo End of 5.0 tests
+
+###########################################################################
+
+#
+# Bug#20550: Stored function: wrong RETURN type metadata when used in a VIEW.
+#
+
+###########################################################################
+
+--echo
+
+--echo #
+--echo # Bug#20550.
+--echo #
+
+--echo
+
+--echo #
+--echo # - Prepare.
+--echo #
+
+--echo
+
+--disable_warnings
+DROP VIEW IF EXISTS v1;
+DROP VIEW IF EXISTS v2;
+DROP FUNCTION IF EXISTS f1;
+DROP FUNCTION IF EXISTS f2;
+--enable_warnings
+
+--echo
+
+--echo #
+--echo # - Create required objects.
+--echo #
+
+--echo
+
+CREATE FUNCTION f1() RETURNS VARCHAR(65525) RETURN 'Hello';
+
+--echo
+
+CREATE FUNCTION f2() RETURNS TINYINT RETURN 1;
+
+--echo
+
+CREATE VIEW v1 AS SELECT f1();
+
+--echo
+
+CREATE VIEW v2 AS SELECT f2();
+
+--echo
+
+--echo #
+--echo # - Check.
+--echo #
+
+--echo
+
+SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'v1';
+
+--echo
+
+SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'v2';
+
+--echo
+
+--echo #
+--echo # - Cleanup.
+--echo #
+
+--echo
+
+DROP FUNCTION f1;
+DROP FUNCTION f2;
+DROP VIEW v1;
+DROP VIEW v2;
+
+--echo
+
+###########################################################################
+
+--echo End of 5.1 tests