Martin Hansson wrote:
> Gleb Shchepa skrev:
>> Martin Hansson wrote:
>>
>>> Gleb Shchepa wrote:
>>>
>>>> Hello Martin,
>>>>
>>>> BTW your patch affects not only outer joins, but queries without
>>>> joins like
>>>>
>>> Yes, this patch is part of a discussion between me and Evgeny. I left it
>>> in 'Patch Pending' so that he wouldn't forget looking at it. You are
>>> welcome to join us, of course.
>>>
>>>> create table t1 (a int);
>>>> insert into t1 values (1), (2);
>>>> select * from t1 group by abs(a) with rollup;
>>>>
>>>> where your function fails with a SEGV.
>>>>
>>> Hmm, not for me. Not on Mac OS SL, nor 32-bit Linux. What's your revno?
>>>
>>
>> sven.sandberg@stripped
>>
>> Program received signal SIGSEGV, Segmentation fault.
>> [Switching to Thread 0xb76d2b70 (LWP 30006)]
>> 0x0829a067 in const_table_is_left_joined_and_sorted_by
>> (join=0x87b9ad8, order=0x87b9a28) at sql_select.cc:7106
>> 7106 DBUG_PRINT("bug47650", ("%s is LEFT OUTER JOINed
>> with %s",
>> (gdb) i s
>> #0 0x0829a067 in const_table_is_left_joined_and_sorted_by
>> (join=0x87b9ad8, order=0x87b9a28) at sql_select.cc:7106
>> #1 0x082b2193 in remove_const (join=0x87b9ad8, first_order=0x87b9a28,
>> cond=0x0, change_list=false, simple_order=0x87babd7)
>> at sql_select.cc:7161
>> #2 0x082b4a46 in JOIN::optimize (this=0x87b9ad8) at sql_select.cc:1234
>> #3 0x082b7661 in mysql_select (thd=0x876b7b0,
>> rref_pointer_array=0x876cc48, tables=0x87b9708, wild_num=1,
>> fields=..., conds=0x0,
>> og_num=1, order=0x0, group=0x87b9a28, having=0x0, proc_param=0x0,
>> select_options=2147764736, result=0x87b9ac0, unit=0x876c8e0,
>> select_lex=0x876cb50) at sql_select.cc:2426
>> #4 0x082bd100 in handle_select (thd=0x876b7b0, lex=0x876c884,
>> result=0x87b9ac0, setup_tables_done_option=0) at sql_select.cc:269
>> #5 0x08228154 in execute_sqlcom_select (thd=0x876b7b0,
>> all_tables=0x87b9708) at sql_parse.cc:5051
>> #6 0x08228e7d in mysql_execute_command (thd=0x876b7b0) at
>> sql_parse.cc:2246
>> #7 0x08232835 in mysql_parse (thd=0x876b7b0, inBuf=0x87b95a0 "select
>> * from t1 group by abs(a) with rollup", length=44,
>> found_semicolon=0xb76d200c) at sql_parse.cc:5970
>> #8 0x08234118 in dispatch_command (command=COM_QUERY, thd=0x876b7b0,
>> packet=0x87b1541 "select * from t1 group by abs(a) with rollup",
>> packet_length=44) at sql_parse.cc:1231
>> #9 0x082356ab in do_command (thd=0x876b7b0) at sql_parse.cc:872
>> #10 0x082205e3 in handle_one_connection (arg=0x876b7b0) at
>> sql_connect.cc:1127
>> #11 0x00f3080e in start_thread (arg=0xb76d2b70) at pthread_create.c:300
>> #12 0x00c797ee in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
>> (gdb) p (order_by_join_tab + 1)->last_inner
>> $1 = (st_join_table *) 0x8f8f8f8f
>> (gdb) p (order_by_join_tab + 1)->table
>> $2 = (TABLE *) 0x8f8f8f8f
>> (gdb) p join->tables
>> $3 = 1
>>
>> Thank you,
>> Gleb.
>>
>>
> I still can't repeat this, but no problem, it's in a DBUG_PRINT, which
> won't be in the final patch anyway. Thank you for taking the time!
if (join->tables > (order_by_join_tab - join->join_tab) &&
(order_by_join_tab + 1)->last_inner)
{
...
return TRUE;
}
around the "(order_by_join_tab + 1)->last_inner" is not a DEBUG_PRINT.
Thank you,
Gleb.