Informix Error -508
-508 Cannot rename a temporary table.
This RENAME TABLE statement cannot be executed because the specified table is temporary. You cannot rename a temporary table. Review the spelling of the table name. If it is as you intended, drop it, and create it again under a different name.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-508 fires when RENAME TABLE targets a temporary table — Informix doesn't support renaming
temp tables at all, regardless of the new name chosen.
RENAME TABLEissued against a temp table, per the official guidance — the direct, only cause.- A misspelled table name that happens to collide with an existing temp table's name, when a different (permanent) table was actually intended.
- Generated schema-migration code that treats temp and permanent tables interchangeably, without checking a table's temporary status before attempting a rename.
Solutions / Resolution
- Review the spelling of the table name, per the official guidance, in case a permanent table was intended instead.
- If the temp table genuinely needs a different name, per the official guidance, drop it and
re-create it under the new name rather than renaming it:
DROP TABLE temp_orders; CREATE TEMP TABLE temp_orders_v2 (...);
Examples
The disallowed attempt
CREATE TEMP TABLE staging_orders (order_id INT, status CHAR(10));
RENAME TABLE staging_orders TO staging_orders_old;
-- -508: staging_orders is a temporary table
Working around it
DROP TABLE staging_orders;
CREATE TEMP TABLE staging_orders_old (order_id INT, status CHAR(10));
Diagnostic Checks
- Confirm whether the target table is temporary before attempting a rename, since temp
tables (including those created
WITH NO LOG) don't appear insystablesthe same way permanent tables persist across sessions — if it was created withCREATE TEMP TABLEin the current session, it's a temp table.
Related Errors / Related Topics
- -509 — "Cannot rename a column in a temporary table." The same restriction applied to column renames instead of table renames.
- -510 — "Cannot create synonym for temporary table table-name." The same restriction applied to synonym creation.
Temporary tables can't be renamed under any circumstances — drop and re-create under the new name instead.