Informix Error -510
-510 Cannot create synonym for temporary table table-name.
This CREATE SYNONYM statement cannot be executed because the specified table is temporary. Review the spelling of the table name. If it is as you intended, redesign the application. Either make the table permanent, or do not use a synonym.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-510 fires when CREATE SYNONYM targets a temporary table — synonyms are a persistent schema
object, and Informix doesn't allow one to point at a table that only exists for the current
session.
CREATE SYNONYMissued 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 permanent table was actually intended.
- Application code that creates a synonym as a convenience alias, not realizing the underlying table is session-scoped temporary rather than permanent.
Solutions / Resolution
- Review the spelling of the table name, per the official guidance, in case a permanent table was intended instead.
- Redesign the application, per the official guidance, by either:
- Making the table permanent (
CREATE TABLEinstead ofCREATE TEMP TABLE) if it needs a synonym, or - Not using a synonym and referencing the temp table by its real name directly, since synonyms aren't necessary within the single session a temp table lives in anyway.
- Making the table permanent (
Examples
The disallowed attempt
CREATE TEMP TABLE staging_orders (order_id INT, status CHAR(10));
CREATE SYNONYM so FOR staging_orders;
-- -510: staging_orders is a temporary table
Working around it — reference the temp table directly
CREATE TEMP TABLE staging_orders (order_id INT, status CHAR(10));
SELECT * FROM staging_orders; -- no synonym needed within the same session
Or make it a permanent table if a synonym is genuinely required
CREATE TABLE staging_orders (order_id INT, status CHAR(10));
CREATE SYNONYM so FOR staging_orders;
Diagnostic Checks
- Confirm whether the table is temporary before attempting to create a synonym for it — a synonym is a durable catalog object and a temp table by definition isn't durable across sessions.
Related Errors / Related Topics
- -508 — "Cannot rename a temporary table." The same temp-table restriction applied to renaming instead of synonym creation.
- -509 — "Cannot rename a column in a temporary table." The same restriction applied to column renames.
A synonym is a persistent catalog object pointing at a session-scoped temp table doesn't make sense — make the table permanent, or skip the synonym and reference it directly.