Informix Error -548
-548 No referential constraint or trigger allowed on a TEMP table.
You cannot create a constraint or a trigger on a temporary (TEMP) table. Consider creating the temporary table as a permanent table in the database. If this option is feasible, create the table, and then create the trigger on it.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-548 fires when CREATE TRIGGER or a referential (FOREIGN KEY) constraint definition targets a
temporary table — another entry in the same family of temp-table restrictions as -508/-509/-510/
-532, since a session-scoped table isn't meant to carry these kinds of persistent, cross-session
relationships.
CREATE TRIGGERissued against a temp table, per the official guidance — a trigger implies ongoing behavior tied to a table that outlives the session, which a temp table doesn't.- A
FOREIGN KEYconstraint defined on (or referencing) a temp table, per the official guidance's general framing of referential constraints not being supported on temp tables. - Staging/ETL code that builds a temp table and then tries to attach the same validation logic (triggers, foreign keys) used on the permanent table it's staging data for, without realizing temp tables can't carry that logic directly.
Solutions / Resolution
- Create the table as a permanent table instead, per the official guidance, if a trigger or
referential constraint is genuinely needed on it:
then create the trigger on it as usual.CREATE TABLE staging_orders (order_id INT, customer_id INT REFERENCES customers(customer_id)); - If the table genuinely needs to be temporary, enforce the equivalent logic in application code instead — validate referenced values before inserting into the temp table, since the database won't enforce it there.
- Drop the temp table once its session-scoped purpose is done, per the normal temp-table lifecycle, rather than trying to give it permanent-table capabilities.
Examples
The disallowed attempt
CREATE TEMP TABLE staging_orders (order_id INT, customer_id INT);
CREATE TRIGGER trg_staging_orders INSERT ON staging_orders
REFERENCING NEW AS post FOR EACH ROW (EXECUTE PROCEDURE validate_order(post.order_id));
-- -548: staging_orders is a temporary table
Making the table permanent instead
CREATE TABLE staging_orders (order_id INT, customer_id INT REFERENCES customers(customer_id));
CREATE TRIGGER trg_staging_orders INSERT ON staging_orders
REFERENCING NEW AS post FOR EACH ROW (EXECUTE PROCEDURE validate_order(post.order_id));
Diagnostic Checks
- Confirm whether the table is temporary before attempting
CREATE TRIGGERor a referential constraint against it — if so, per the official guidance, making it permanent is the documented path forward.
Related Errors / Related Topics
- -508 — "Cannot rename a temporary table." Same family of temp-table restrictions.
- -509 — "Cannot rename a column in a temporary table." Same family.
- -510 — "Cannot create synonym for temporary table table-name." Same family.
- -532 — "Cannot alter temporary table table-name." Same family.
Part of the standing family of temp-table restrictions — make the table permanent if triggers or referential constraints are genuinely needed.