Informix Error -781
-781 Cannot alter fragmentation on a temp table.
You tried to alter a fragment that is based on a temporary table. In general, dynamic modification of a TEMP table is not allowed. You must re-create the temporary table if you require a different fragmentation scheme.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-781 fires when ALTER FRAGMENT targets a temporary table — per the official guidance, dynamic
modification of a temp table isn't allowed in general, the same underlying principle behind the
standing family of temp-table restrictions (-508/-509/-510/-532/-548/-576), applied here to
fragmentation specifically.
ALTER FRAGMENTissued against a temp table, per the official guidance — the direct, only cause.- DDL copy-pasted from a permanent-table maintenance script, applied to a temp table by mistake.
Solutions / Resolution
- Re-create the temporary table with the desired fragmentation scheme from the start, per
the official guidance — this is the only path, since dynamic modification isn't supported:
DROP TABLE staging_orders; CREATE TEMP TABLE staging_orders (order_id INT, region CHAR(10)) FRAGMENT BY EXPRESSION (region = 'east') IN east_dbspace, (region = 'west') IN west_dbspace; - Plan the temp table's fragmentation scheme upfront, if performance considerations make fragmentation important for this specific temp table's workload, since it can't be adjusted afterward.
Examples
The disallowed attempt
CREATE TEMP TABLE staging_orders (order_id INT, region CHAR(10));
ALTER FRAGMENT ON TABLE staging_orders INIT FRAGMENT BY EXPRESSION
(region = 'east') IN east_dbspace, (region = 'west') IN west_dbspace;
-- -781: staging_orders is a temporary table
Corrected — fragment at creation time
CREATE TEMP TABLE staging_orders (order_id INT, region CHAR(10))
FRAGMENT BY EXPRESSION
(region = 'east') IN east_dbspace, (region = 'west') IN west_dbspace;
Diagnostic Checks
- Confirm whether the table is temporary before attempting
ALTER FRAGMENT— if so, re-creating it with the fragmentation scheme built in is the only path.
Related Errors / Related Topics
- -508 through -510, -532, -548, -576 — the standing family of temp-table restrictions this fragmentation restriction belongs to.
- -780 — "Table/index is not fragmented." A related
ALTER FRAGMENTerror, about a permanent table/index that was simply never fragmented, rather than the temp-table restriction here.
Part of the standing family of temp-table restrictions — re-create the temp table with its fragmentation scheme built in from the start.