| 1460 | */ |
| 1461 | |
| 1462 | bool st_select_lex::check_unrestricted_recursive(bool only_standard_compliant) |
| 1463 | { |
| 1464 | With_element *with_elem= get_with_element(); |
| 1465 | if (!with_elem ||!with_elem->is_recursive) |
| 1466 | { |
| 1467 | /* |
| 1468 | If this select is not from the specification of a with elememt or |
| 1469 | if this not a recursive with element then there is nothing to check. |
| 1470 | */ |
| 1471 | return false; |
| 1472 | } |
| 1473 | |
| 1474 | /* Check conditions 1-2 for restricted specification*/ |
| 1475 | table_map unrestricted= 0; |
| 1476 | table_map encountered= 0; |
| 1477 | if (with_elem->check_unrestricted_recursive(this, |
| 1478 | unrestricted, |
| 1479 | encountered)) |
| 1480 | return true; |
| 1481 | with_elem->get_owner()->add_unrestricted(unrestricted); |
| 1482 | |
| 1483 | |
| 1484 | /* Check conditions 3-4 for restricted specification*/ |
| 1485 | if ((with_sum_func && !with_elem->is_anchor(this)) || |
| 1486 | (with_elem->contains_sq_with_recursive_reference())) |
| 1487 | with_elem->get_owner()->add_unrestricted( |
| 1488 | with_elem->get_mutually_recursive()); |
| 1489 | |
| 1490 | /* Report an error on unrestricted specification if this is required */ |
| 1491 | if (only_standard_compliant && with_elem->is_unrestricted()) |
| 1492 | { |
| 1493 | my_error(ER_NOT_STANDARD_COMPLIANT_RECURSIVE, |
| 1494 | MYF(0), with_elem->get_name_str()); |
| 1495 | return true; |
| 1496 | } |
| 1497 | |
| 1498 | return false; |
| 1499 | } |
| 1500 | |
| 1501 | |
| 1502 | /** |
no test coverage detected