Informix Error -866
-866 Cannot attach tables that contain serial fields.
Before you use an ALTER FRAGMENT... ATTACH statement, you must drop any serial fields or modify the column type.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-866 fires when ALTER FRAGMENT ... ATTACH targets a table containing a SERIAL/SERIAL8/
BIGSERIAL column — per the official guidance, serial fields must be dropped, or the column's
type modified, before the attach.
- A table being attached (or the surviving table) with a
SERIAL-family column, per the official guidance — the direct, only cause; serial columns auto-generate values per table, which conflicts with how attach combines tables into fragments of one logical table. - A primary-key or ID column declared
SERIALthat was never intended to need attaching, only discovered when the attach operation itself failed.
Solutions / Resolution
- Drop the serial field, per the official guidance, if it's not actually needed as an auto-generated identifier going forward.
- Or modify the column's type from
SERIAL/SERIAL8/BIGSERIALto the corresponding plain integer type (INTEGER/INT8/BIGINT, per the same mapping used for -670), per the official guidance, if the column's existing values need to be preserved but auto-generation isn't required going forward:ALTER TABLE orders_2025 MODIFY (order_id INTEGER); - Then retry the attach, once the serial field is resolved.
Examples
Modifying a serial column before attaching
ALTER TABLE orders_2025 MODIFY (order_id INTEGER);
ALTER FRAGMENT ON TABLE orders ATTACH orders_2025;
Diagnostic Checks
- Check both the surviving table and the table(s) being attached for
SERIAL/SERIAL8/BIGSERIALcolumns, and resolve each (drop or modify type) before retrying.
Related Errors / Related Topics
- -593 — "Cannot specify default value for SERIAL or SERIAL8 or BIGSERIAL column." A related
SERIAL-family restriction, in theDEFAULTclause context rather thanATTACH. - -782 — "Attached table is fragmented." A related
ATTACHrestriction, on the attached table's fragmentation status.
Drop the serial column, or convert it to the corresponding plain integer type, before attaching.