Bug #302 Calling a procedure with a subselect as argument cause crash
Submitted: 17 Apr 2003 4:54 Modified: 23 Apr 2003 12:32
Reporter: Per-Erik Martin Email Updates:
Status: Closed Impact on me:
Category:MySQL Server Severity:S1 (Critical)
Version:5.0 OS:Any (All)
Assigned to: Oleksandr Byelkin CPU Architecture:Any

[17 Apr 2003 4:54] Per-Erik Martin
This was reported as part of #280 by Jocelyn Fournier, but is a different

Call with subselect crashed too :

call u((SELECT 1))|

Stack trace :

0x80aeab7 handle_segfault + 487
0x82b49d8 pthread_sighandler + 176
0x808d9f3 Item_subselect::fix_fields(THD*, st_table_list*, Item**) + 35
0x815f8ee eval_func_item(THD*, Item*, enum_field_types) + 62
0x815f0d2 sp_head::execute_procedure(THD*, List<Item>*) + 434
0x80c1439 mysql_execute_command(THD*) + 18585
0x80c23f4 mysql_parse(THD*, char*, unsigned) + 260
0x80bb8f9 dispatch_command(enum_server_command, THD*, char*, unsigned) +
0x80bb4e7 do_command(THD*) + 135
0x80babf3 handle_one_connection + 515
0x82b23fa pthread_start_thread + 218
0x82e694a thread_start + 4

How to repeat:
create procedure p(x int) insert test.t1 values ("foo", x);

call p((select 1));
[23 Apr 2003 7:40] Per-Erik Martin
This is partially fixed:

call u((select 1))  now works.

But this still crashes (should either work or return an error message):

call u((select x from table limit 1))

This should always return an error message:

call u((select x,y from table limit 1))  # 2 fields

This should either always return an error message,
or only when returning more than one row:

call u((select x from table))            # 1+ rows?

If nothing else works, simply return an error message for
all subselects, rather than getting core dumps for some.