Commit 777bda4b authored by Vicențiu Ciorbaru's avatar Vicențiu Ciorbaru

Fix view

parent 7d1afaf0
......@@ -3737,17 +3737,37 @@ void st_select_lex::print_limit(THD *thd,
return;
}
}
// TODO(cvicentiu) limit_params.with_ties requires different printing!
if (limit_params.explicit_limit &&
limit_params.select_limit)
{
str->append(STRING_WITH_LEN(" limit "));
if (limit_params.offset_limit)
/*
[OFFSET n]
FETCH FIRST n ROWS WITH TIES
For FETCH FIRST n ROWS ONLY we fall back to the "limit" specification
as it's identical.
*/
if (limit_params.with_ties)
{
limit_params.offset_limit->print(str, query_type);
str->append(',');
if (limit_params.offset_limit)
{
str->append(STRING_WITH_LEN(" offset "));
limit_params.offset_limit->print(str, query_type);
}
str->append(STRING_WITH_LEN(" fetch first "));
limit_params.select_limit->print(str, query_type);
str->append(STRING_WITH_LEN(" rows with ties"));
}
else
{
str->append(STRING_WITH_LEN(" limit "));
if (limit_params.offset_limit)
{
limit_params.offset_limit->print(str, query_type);
str->append(',');
}
limit_params.select_limit->print(str, query_type);
}
limit_params.select_limit->print(str, query_type);
}
}
......
......@@ -1362,13 +1362,10 @@ JOIN::prepare(TABLE_LIST *tables_init, COND *conds_init, uint og_num,
{
bool real_order= FALSE;
ORDER *ord;
/* WITH TIES forces the results to be sorted, even if it's not sortable? */
// TODO(cvicentiu) -> Check this...
/* WITH TIES forces the results to be sorted, even if it's not sanely
sortable. */
if (select_lex->limit_params.with_ties)
{
real_order= true;
alloc_order_fields(this, order);
}
for (ord= order; ord; ord= ord->next)
{
......
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