<p>Error 1395 occurs when a DELETE statement targets a non-updatable join view created with the MERGE algorithm.</p>
<p>MySQL Error 1395: ER_VIEW_DELETE_MERGE_VIEW signals that you attempted to delete rows from a join view that cannot propagate changes to its base tables. Switch to deleting directly from a single base table, create an updatable view, or refactor the view with ALGORITHMTEMPTABLE to resolve the issue.</p>
Can not delete from join view '%s.%s'
Error 1395 appears with the message Can not delete from join view '%s.%s'. It triggers when a DELETE command targets a view defined with ALGORITHM=MERGE that joins two or more tables. Such views are read only for DELETE, UPDATE, and INSERT operations because MySQL cannot unambiguously map the change back to multiple source tables.
The error is common in reporting layers where developers attempt to clean data via convenient join views instead of manipulating base tables. MySQL blocks the statement to protect data integrity.
The error fires in MySQL versions 5.0 and later whenever a DELETE or multi-table DELETE lists a non-updatable join view. It also occurs in stored procedures, triggers, and applications that dynamically build DELETE queries against composite views.
Ignoring the error stalls data maintenance jobs, ETL pipelines, and application workflows that rely on deleting stale rows. Understanding the limitation lets you redesign queries, ensuring consistent data and preventing outages.
The primary cause is using a MERGE algorithm join view in a DELETE statement. MySQL cannot decide which underlying table(s) should receive the delete operation.
Secondary triggers include missing primary keys, views that aggregate columns, or views that reference another view that is itself non-updatable.
Delete directly from the target base table instead of the join view. Identify the rows using a subquery or JOIN, then run a single-table DELETE.
Alternatively, create an updatable view containing only one base table column set, or redefine the view with ALGORITHMTEMPTABLE so that it becomes read only and you consciously avoid write attempts.
Scheduled cleanup job fails: Refactor the job to DELETE FROM base_table WHERE id IN (SELECT id FROM join_view WHERE ...).
Interactive admin panel error: Patch the ORM layer to target base tables for deletes, or enable the panel to switch to CALL stored procedure that handles deletes safely.
Design views primarily for SELECT operations. Perform DML on base tables or on explicitly updatable views with a single underlying table.
Add unit tests that exercise delete paths in staging. Monitor application logs for HY000 SQLSTATE to catch regressions early.
Error 1288 (HY000) The target table of the UPDATE is not updatable - occurs when updating a non-updatable view. Fix by targeting base tables or creating an updatable view.
Error 1348 (HY000) Column '%s' is not updatable - appears when modifying a derived column in a view. Remove the derived column from the DML.
MySQL blocks DELETE because it cannot map the row to a single table.
Aggregations make rows non-unique and therefore not directly deletable.
Without unique keys, MySQL cannot guarantee a safe delete path.
A view built on another non-updatable view inherits the restriction.
Raised on UPDATE statements against non-updatable views. Fix by updating base tables.
Occurs when attempting to modify derived or aggregated columns in a view.
Appears when a trigger tries to modify a table in a different schema without proper rights.
Occurs when DML is executed inside a stored function that violates side-effect rules.
Only if the view is explicitly declared updatable and references a single underlying table. Standard join views are read only for DELETE.
It will suppress the error by making the view read only, but it does not allow the delete. You still need to delete from base tables.
No. SQL_SAFE_UPDATES enforces WHERE restrictions but does not override the non-updatable view limitation.
Galaxy's AI copilot warns when a DELETE targets a non-updatable view and suggests the correct base-table query, preventing runtime failures.