| 1418 | */ |
| 1419 | |
| 1420 | void update_non_unique_table_error(TABLE_LIST *update, |
| 1421 | const char *operation, |
| 1422 | TABLE_LIST *duplicate) |
| 1423 | { |
| 1424 | update= update->top_table(); |
| 1425 | duplicate= duplicate->top_table(); |
| 1426 | if (!update->view || !duplicate->view || |
| 1427 | update->view == duplicate->view || |
| 1428 | !update->view_name.streq(duplicate->view_name) || |
| 1429 | !update->view_db.streq(duplicate->view_db)) |
| 1430 | { |
| 1431 | /* |
| 1432 | it is not the same view repeated (but it can be parts of the same copy |
| 1433 | of view), so we have to hide underlying tables. |
| 1434 | */ |
| 1435 | if (update->view) |
| 1436 | { |
| 1437 | /* Issue the ER_NON_INSERTABLE_TABLE error for an INSERT */ |
| 1438 | if (update->view == duplicate->view) |
| 1439 | my_error(!strncmp(operation, "INSERT", 6) ? |
| 1440 | ER_NON_INSERTABLE_TABLE : ER_NON_UPDATABLE_TABLE, MYF(0), |
| 1441 | update->alias.str, operation); |
| 1442 | else |
| 1443 | my_error(ER_VIEW_PREVENT_UPDATE, MYF(0), |
| 1444 | (duplicate->view ? duplicate->alias.str : update->alias.str), |
| 1445 | operation, update->alias.str); |
| 1446 | return; |
| 1447 | } |
| 1448 | if (duplicate->view) |
| 1449 | { |
| 1450 | my_error(ER_VIEW_PREVENT_UPDATE, MYF(0), duplicate->alias.str, operation, |
| 1451 | update->alias.str); |
| 1452 | return; |
| 1453 | } |
| 1454 | } |
| 1455 | my_error(ER_UPDATE_TABLE_USED, MYF(0), update->alias.str, operation); |
| 1456 | } |
| 1457 | |
| 1458 | |
| 1459 | /** |
no test coverage detected