Informix Error -897
-897 Cannot modify/drop a violations/diagnostics table.
The user has tried to alter or drop a table that is serving as a violations table or a diagnostics table for another table.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-897 fires when ALTER TABLE or DROP TABLE targets a table that's currently serving as a
violations table or diagnostics table for another table — per the official guidance, these
tables are managed by the violations/diagnostics mechanism itself and can't be altered or
dropped directly.
ALTER TABLE/DROP TABLEtargeting a table currently serving as a violations table, per the official guidance.ALTER TABLE/DROP TABLEtargeting a table currently serving as a diagnostics table, per the official guidance.
Solutions / Resolution
- Stop the violations table relationship first, via
STOP VIOLATIONS TABLEon the target table these tables belong to, per -896's discussion:STOP VIOLATIONS TABLE FOR orders; - Then alter or drop the (now-independent) former violations/diagnostics table, once it's no longer serving in that role.
- Identify which target table a given violations/diagnostics table belongs to, if it's not
obvious, before attempting
STOP VIOLATIONS TABLE.
Examples
Stopping the violations table relationship before dropping it
STOP VIOLATIONS TABLE FOR orders;
DROP TABLE orders_viol;
Diagnostic Checks
- Confirm whether the table being altered/dropped is currently serving as a violations/diagnostics table, and if so, identify the target table it belongs to.
Related Errors / Related Topics
- -895 — "Cannot create violations/diagnostics table." A related error, about failing to create one, rather than being unable to modify/drop an existing one.
- -898 — "Cannot alter a table which has associated violations/diagnostics tables." The mirror-image restriction: altering the target table itself, rather than its violations/diagnostics table.
Stop the violations table relationship first (STOP VIOLATIONS TABLE), then alter or drop the
now-independent table.