Informix Error -523
-523 Can only recover, repair or drop table.
This statement (RECOVER, REPAIR, or DROP) specifies a view. However, these statements are only supported for real tables, not views. In the case of DROP, if you drop any of the tables used in the view, the view will be removed as well. To recover or repair this table, you must recover or repair the tables on which the view is defined. For a way to list the names of tables that are views, see the discussion of error -394.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-523 fires when RECOVER TABLE, REPAIR TABLE, or DROP TABLE is issued against a view —
those three statements only operate on real, storage-backed tables.
RECOVER TABLEorREPAIR TABLEtargeting a view — per the official guidance, these operate on the physical table structure, which a view doesn't have.DROP TABLE(rather thanDROP VIEW) issued against a view by mistake, since the two statements aren't interchangeable even though both remove a named object.- Confusion between a view and the base table it's built from, especially where naming conventions make the two hard to tell apart at a glance.
Solutions / Resolution
- For
DROP, useDROP VIEWinstead, since dropping a view is a separate statement from dropping a table:DROP VIEW active_orders_view; - For
RECOVER/REPAIR, target the underlying table(s) the view is built on, per the official guidance — recovering or repairing a view isn't meaningful; the real tables it selects from are what actually need recovery/repair. - Note that dropping a base table used by a view removes the view too, per the official
guidance — a
DROP TABLEon the underlying table cascades to any view defined on it.
Examples
The disallowed attempt
DROP TABLE active_orders_view;
-- -523: active_orders_view is a view
Corrected
DROP VIEW active_orders_view;
Repairing the real table behind a view
-- active_orders_view is defined as SELECT ... FROM orders WHERE status = 'active'
REPAIR TABLE orders;
Diagnostic Checks
- Query
systablesto confirm whether a name refers to a view or a base table before issuingRECOVER/REPAIR/DROP TABLEagainst it:SELECT tabname, tabtype FROM systables WHERE tabname = 'active_orders_view';tabtype = 'V'indicates a view.
Related Errors / Related Topics
No closely related error codes are cross-referenced for -523 in this set yet.
RECOVER/REPAIR/DROP TABLE only apply to real tables — use DROP VIEW for a view, and
target the underlying table(s) directly for recover/repair.