Bug #118 SELECT INTO @vars crash with certain complex expressions
Submitted: 4 Mar 2003 7:45 Modified: 26 Mar 2003 8:01
Reporter: Per-Erik Martin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.1 5.0 OS:Any
Assigned to: CPU Architecture:Any

[4 Mar 2003 7:45] Per-Erik Martin
Description:
Select into variables sometimes causes the server to SIGSEGV, like

"select max(i)+1,max(p)+1 into @i,@p from t1;"

while other, similar (but simpler) cases work. This also happens when
the target variables are local variables in a stored procedure (in 5.0).

How to repeat:
use test;

drop table if exists t1;

create table t1 (
  i int unsigned not null primary key,
  p bigint unsigned not null
);

insert into t1 values
 ( 0,   3), ( 1,   5), ( 2,   7), ( 3,  11), ( 4,  13),
 ( 5,  17), ( 6,  19), ( 7,  23), ( 8,  29), ( 9,  31);

# These work...
select max(i), max(p) from t1;
select max(i)+1, max(p)+1 from t1;
select max(i), max(p) into @i, @p from t1;
select @i, @p;

# ...but not this, it causes a SIGSEGV.
select max(i)+1,max(p)+1 into @i,@p from t1;
[26 Mar 2003 8:01] MySQL Verification Team
Commited and pushed