Informix Error -576
-576 Cannot specify CONSTRAINT name for TEMP table.
You cannot specify a constraint (either UNIQUE, PRIMARY KEY, or CHECK) name for constraints placed on temporary tables. This action is not supported for a temporary table. However, you can specify that a column receives one of these constraints, and you can specify a list of columns as having a constraint, but you may not use the CONSTRAINT constraint-name clause. Temporary tables and their indexes are not recorded in the usual system catalog tables.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-576 fires when a CREATE TEMP TABLE includes a CONSTRAINT constraint-name clause naming a
UNIQUE, PRIMARY KEY, or CHECK constraint — per the official guidance, temp tables and their
indexes aren't recorded in the usual system catalog tables, so there's nowhere for a named
constraint to be cataloged. The constraint type itself (as an unnamed, column-level or
table-level clause) is still allowed.
CONSTRAINT constraint-nameused on aUNIQUE/PRIMARY KEY/CHECKclause within aCREATE TEMP TABLE— per the official guidance, the direct, only cause.- DDL copy-pasted from a permanent-table template that includes named constraints, adapted
into a
CREATE TEMP TABLEwithout removing the naming clause.
Solutions / Resolution
- Remove the
CONSTRAINT constraint-nameclause, per the official guidance, while keeping the constraint itself (UNIQUE,PRIMARY KEY, orCHECK) unnamed. - Specify the constraint on a column, or as a column-list clause, without naming it, per the official guidance — both are supported; only the explicit name is disallowed.
Examples
The disallowed named constraint
CREATE TEMP TABLE staging_orders (
order_id INT,
status CHAR(10) CONSTRAINT ck_status CHECK (status IN ('pending','shipped'))
);
-- -576: CONSTRAINT ck_status not allowed on a temp table
Corrected — unnamed constraint
CREATE TEMP TABLE staging_orders (
order_id INT,
status CHAR(10) CHECK (status IN ('pending','shipped'))
);
Diagnostic Checks
- Scan the
CREATE TEMP TABLEstatement for anyCONSTRAINT constraint-nameclause and remove the naming portion while keeping the constraint definition itself.
Related Errors / Related Topics
- -508 — "Cannot rename a temporary table." Same general 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.
- -548 — "No referential constraint or trigger allowed on a TEMP table." Same family, for a different constraint type (referential) that isn't supported on temp tables at all, rather than supported-but-unnamed.
Part of the standing family of temp-table restrictions — the constraint type is still allowed,
just not with an explicit CONSTRAINT constraint-name clause.