Informix Error -872
-872 Invalid fragment strategy or expression for the unique index.
The round-robin method cannot fragment unique indexes. If the expression method fragments the indexes, all the columns that are used in the fragmentation expressions must also be part of the index key.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-872 fires in two related situations, per the official guidance: a unique index fragmented by round-robin (not supported for unique indexes at all), or a unique index fragmented by expression where the expression references a column not part of the index's own key.
- Round-robin fragmentation attempted on a unique index, per the official guidance — this method simply isn't supported for unique indexes, the same underlying restriction referenced by -774's own example.
- Expression-based fragmentation on a unique index, where the expression references a column outside the index's key columns, per the official guidance — every column used in the fragmentation expression must also be part of the index key.
Solutions / Resolution
- Use a different fragmentation method for a unique index, per the official guidance, if round-robin was attempted — expression-based fragmentation (meeting the key-column requirement) or same-as-table fragmentation are the alternatives.
- Ensure every column in the fragmentation expression is also part of the index's key columns, per the official guidance, if using expression-based fragmentation on a unique index.
Examples
Round-robin on a unique index
CREATE UNIQUE INDEX idx_orders_id ON orders (order_id)
FRAGMENT BY ROUND ROBIN IN dbspace1, dbspace2;
-- -872: round-robin isn't supported for unique indexes
An expression referencing a non-key column
CREATE UNIQUE INDEX idx_orders_id ON orders (order_id)
FRAGMENT BY EXPRESSION
(region = 'east') IN dbspace1, REMAINDER IN dbspace2;
-- -872: 'region' isn't part of the index key (order_id)
Corrected — expression using only key columns
CREATE UNIQUE INDEX idx_orders_id ON orders (order_id)
FRAGMENT BY EXPRESSION
(order_id < 1000) IN dbspace1, REMAINDER IN dbspace2;
Diagnostic Checks
- Check the fragmentation method — round-robin is never valid for a unique index.
- For expression-based fragmentation, compare every column referenced in the expression against the index's key columns.
Related Errors / Related Topics
- -774 — "Cannot specify fragment expressions with a round-robin fragmentation." A related restriction — this error's round-robin case is the same underlying incompatibility, specific to unique indexes.
- -873 — "Invalid fragment expression column." A related restriction, about referencing columns from a different table entirely, rather than a column outside the index's own key.
Round-robin never works for unique indexes; for expression-based fragmentation, every referenced column must also be part of the index's key.