From 05f9e4dd0ec743b352eb480ec8eab3af046b745d Mon Sep 17 00:00:00 2001 From: unknown <pem@mysql.comhem.se> Date: Tue, 15 Jun 2004 14:26:19 +0200 Subject: [PATCH] Fixed BUG#3368: Stored procedure crash if group_concat(variable). mysql-test/r/sp.result: New test case for BUG#3368. mysql-test/t/sp.test: New test case for BUG#3368. sql/item.h: Corrected const_item() for item_splocal. (Confusing semantics here, but this makes group_concat() behave as expected, instead of crashing, and does not appear to affect anything else.) --- mysql-test/r/sp.result | 15 +++++++++++++++ mysql-test/t/sp.test | 19 +++++++++++++++++++ sql/item.h | 2 +- 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 306b4ba89a8..7f496000644 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -1372,6 +1372,21 @@ select 1+2| 1+2 3 drop procedure bug3843| +drop table if exists t3| +create table t3 ( s1 char(10) )| +insert into t3 values ('a'), ('b')| +create procedure bug3368(v char(10)) +begin +select group_concat(v) from t3; +end| +call bug3368('x')| +group_concat(v) +x,x +call bug3368('yz')| +group_concat(v) +yz,yz +drop procedure bug3368| +drop table t3| drop table if exists fac| create table fac (n int unsigned not null primary key, f bigint unsigned)| create procedure ifac(n int unsigned) diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 0e95eb154d0..fbe9060bfa1 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -1573,6 +1573,25 @@ select 1+2| drop procedure bug3843| +# +# BUG#3368 +# +--disable_warnings +drop table if exists t3| +--enable_warnings +create table t3 ( s1 char(10) )| +insert into t3 values ('a'), ('b')| + +create procedure bug3368(v char(10)) +begin + select group_concat(v) from t3; +end| + +call bug3368('x')| +call bug3368('yz')| +drop procedure bug3368| +drop table t3| + # # Some "real" examples diff --git a/sql/item.h b/sql/item.h index 8847cb35493..69a6718a5a9 100644 --- a/sql/item.h +++ b/sql/item.h @@ -332,7 +332,7 @@ class Item_splocal : public Item inline bool const_item() const { - return FALSE; + return TRUE; } inline int save_in_field(Field *field, bool no_conversions) -- 2.30.9