Commit 181f753e authored by Tor Didriksen's avatar Tor Didriksen

Bug #50271: Debug output of JOIN structures is garbled


sql/sql_test.cc:
  Assemble results of all the calls to full_name() first,
  in order not to garble the tabular output.
parent 7805a2c7
...@@ -168,6 +168,21 @@ TEST_join(JOIN *join) ...@@ -168,6 +168,21 @@ TEST_join(JOIN *join)
uint i,ref; uint i,ref;
DBUG_ENTER("TEST_join"); DBUG_ENTER("TEST_join");
/*
Assemble results of all the calls to full_name() first,
in order not to garble the tabular output below.
*/
String ref_key_parts[MAX_TABLES];
for (i= 0; i < join->tables; i++)
{
JOIN_TAB *tab= join->join_tab + i;
for (ref= 0; ref < tab->ref.key_parts; ref++)
{
ref_key_parts[i].append(tab->ref.items[ref]->full_name());
ref_key_parts[i].append(" ");
}
}
DBUG_LOCK_FILE; DBUG_LOCK_FILE;
VOID(fputs("\nInfo about JOIN\n",DBUG_FILE)); VOID(fputs("\nInfo about JOIN\n",DBUG_FILE));
for (i=0 ; i < join->tables ; i++) for (i=0 ; i < join->tables ; i++)
...@@ -199,13 +214,8 @@ TEST_join(JOIN *join) ...@@ -199,13 +214,8 @@ TEST_join(JOIN *join)
} }
if (tab->ref.key_parts) if (tab->ref.key_parts)
{ {
VOID(fputs(" refs: ",DBUG_FILE)); fprintf(DBUG_FILE,
for (ref=0 ; ref < tab->ref.key_parts ; ref++) " refs: %s\n", ref_key_parts[i].ptr());
{
Item *item=tab->ref.items[ref];
fprintf(DBUG_FILE,"%s ", item->full_name());
}
VOID(fputc('\n',DBUG_FILE));
} }
} }
DBUG_UNLOCK_FILE; DBUG_UNLOCK_FILE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment