Informix Error -19822: Cannot alter or truncate a table or drop a table or view using a synonym.
Cause and resolution
Cannot alter or truncate a table or drop a table or view using a synonym.
You cannot perform an alter or drop on a table or view using a synonym. Specify the <table-name> or <view-name> instead. </view-name></table-name>
Or, to drop or alter the table or view using the synonym, first unset the environment variable USETABLENAME.
If you intend to drop the synonym, specify DROP SYNONYM <synonym-name> instead. </synonym-name>
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-19822 fires when ALTER/TRUNCATE/DROP is given a synonym instead of the actual
table/view name — per the official guidance.
- A synonym used in place of the actual table/view name in an
ALTER/TRUNCATE/DROPstatement, per the official guidance — the direct, only cause.
Solutions / Resolution
- Specify the actual table or view name instead of the synonym, per the official guidance.
- Unset the
USETABLENAMEenvironment variable, per the official guidance, as an alternative if the operation must go through the synonym. - Use
DROP SYNONYM <synonym-name>if dropping the synonym itself is intended, per the official guidance.
Examples
Altering via a synonym
ALTER TABLE mysynonym ADD col1 INT;
Corrected
ALTER TABLE actual_table_name ADD col1 INT;
Diagnostic Checks
- Check whether the target is a synonym, and substitute the actual table/view name, or
DROP SYNONYMif that was actually intended.
Related Errors / Related Topics
- -19821 — "Cannot rename a table using a synonym." The same restriction, for
RENAMErather thanALTER/TRUNCATE/DROP.
ALTER/TRUNCATE/DROP can't target a synonym — use the actual name, or DROP SYNONYM if
that's what's intended.