Bug #1188 GROUP_CONCAT crashes on a sub-query that returns 0 rows

Submitted: 3 Sep 2003 9:29 Modified: 4 Sep 2003 5:05
Reporter: Oliver Tupman Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version: 4.1.0-alpha-max-nt OS:Windows (Windows 2000)
Assigned to: Vasily Kishkin CPU Architecture:Any

[3 Sep 2003 9:29] Oliver Tupman
Description:
Query that fails is this:

SELECT GROUP_CONCAT(BugID  SEPARATOR  ",") as knownIssueIDs
FROM (
  SELECT *
  FROM BugComment
  GROUP BY BugComment.BugID
) as t1

If the sub-query returns 1 or more rows then it's fine (returns a comma seperated list). 

If sub-query returns 0 rows then MySQL crashes. Not sure how to elicit a stack-trace. Will provide if someone can tell me how.

How to repeat:
Try GROUP_CONCAT on a sub-query that will return 0 rows.
[3 Sep 2003 11:57] Indrek Siitan
Verified.

Program received signal SIGSEGV, Segmentation fault.
0x80cde80 in copy_fields (param=0xab92948) at sql_select.cc:7980
7980        (*ptr->do_copy)(ptr);
(gdb) bt
#0  0x80cde80 in copy_fields (param=0xab92948) at sql_select.cc:7980
#1  0x8059a76 in Item_func_group_concat::add (this=0xab91170)
    at item_sum.cc:1703
#2  0x82d0fe2 in Item_sum::no_rows_in_result (this=0xab91170) at item_sum.h:65
#3  0x80c4aaa in return_zero_rows (join=0xac04028, result=0xab928f8,
    tables=0xab91768, fields=@0xab7f3c4, send_row=true, select_options=0,
    info=0x833b4a0 "no matching row in const table", having=0x0,
    procedure=0x0, unit=0xab7f29c) at sql_select.cc:3877
#4  0x80bdb5e in JOIN::exec (this=0xac04028) at sql_select.cc:1082
#5  0x80bf239 in mysql_select (thd=0xab7f018, rref_pointer_array=0xab7f45c,
    tables=0xab91768, wild_num=0, fields=@0xab7f3c4, conds=0x0, og_num=0,
    order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=17339392,
    result=0xab928f8, unit=0xab7f29c, select_lex=0xab7f364,
    tables_and_fields_initied=false) at sql_select.cc:1538
#6  0x80bb8b7 in handle_select (thd=0xab7f018, lex=0xab7f290, result=0xab928f8)
    at sql_select.cc:188
#7  0x809ced8 in mysql_execute_command (thd=0xab7f018) at sql_parse.cc:1769
#8  0x80a1c4d in mysql_parse (thd=0xab7f018,
    inBuf=0xab91028 "SELECT GROUP_CONCAT(BugID  SEPARATOR  \",\") as knownIssueIDs\nFROM 
(\n  SELECT *\n  FROM BugComment\n  GROUP BY BugComment.BugID\n) as t1", length=131) at 
sql_parse.cc:3681
#9  0x809bc87 in dispatch_command (command=COM_QUERY, thd=0xab7f018,
    packet=0xabcf019 "", packet_length=132) at sql_parse.cc:1285
#10 0x809b637 in do_command (thd=0xab7f018) at sql_parse.cc:1120
#11 0x809acec in handle_one_connection (arg=0xab7f018) at sql_parse.cc:899
#12 0x2850741f in _thread_start () from /usr/lib/libc_r.so.4
#13 0x0 in ?? ()
[4 Sep 2003 5:05] Indrek Siitan
This has been fixed in our BK tree and the fix will be available in 4.1.1.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.