| 7365 | */ |
| 7366 | |
| 7367 | void Item_equal::update_const(THD *thd) |
| 7368 | { |
| 7369 | List_iterator<Item> it(equal_items); |
| 7370 | if (with_const) |
| 7371 | it++; |
| 7372 | Item *item; |
| 7373 | while ((item= it++)) |
| 7374 | { |
| 7375 | if (item->can_eval_in_optimize() && |
| 7376 | /* |
| 7377 | Don't propagate constant status of outer-joined column. |
| 7378 | Such a constant status here is a result of: |
| 7379 | a) empty outer-joined table: in this case such a column has a |
| 7380 | value of NULL; but at the same time other arguments of |
| 7381 | Item_equal don't have to be NULLs and the value of the whole |
| 7382 | multiple equivalence expression doesn't have to be NULL or FALSE |
| 7383 | because of the outer join nature; |
| 7384 | or |
| 7385 | b) outer-joined table contains only 1 row: the result of |
| 7386 | this column is equal to a row field value *or* NULL. |
| 7387 | Both values are inacceptable as Item_equal constants. |
| 7388 | */ |
| 7389 | !item->is_outer_field()) |
| 7390 | { |
| 7391 | if (item == equal_items.head()) |
| 7392 | with_const= TRUE; |
| 7393 | else |
| 7394 | { |
| 7395 | it.remove(); |
| 7396 | add_const(thd, item); |
| 7397 | } |
| 7398 | } |
| 7399 | } |
| 7400 | } |
| 7401 | |
| 7402 | |
| 7403 | /** |
no test coverage detected