Informix Error -2858
-2858 The table table-1 is joined to the table table-2, but its joined
columns do not belong to a composite key.You have defined two or more different joining columns between the two indicated tables. However, no composite index exists on the joining columns. Such an index is required to ensure that a composite key exists; that is, that any combination of values from the joining columns will occur only once. Review the two or more ATTRIBUTES statements that define join columns for these two tables. Make sure that they are as you intended; for example, make sure that you intended to join two tables on two or more columns, instead of joining three or more tables on one column each. If you intended the composite key, then use the CREATE INDEX command to create a composite unique index on those columns for at least table1.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-2858 fires when two tables are joined on multiple columns that don't form a composite unique index — per the official guidance, a composite unique index on the joining columns is required to ensure data integrity.
- Multiple joining columns defined between two tables with no corresponding composite unique index, per the official guidance — the direct, only cause.
Solutions / Resolution
- Review the
ATTRIBUTESstatements defining the join columns and verify they match the intended table relationships, per the official guidance. - If a composite key was intended, create one using
CREATE INDEX, per the official guidance.
Examples
Creating the required composite unique index
CREATE UNIQUE INDEX idx_order_items ON order_items (order_id, item_seq);
Diagnostic Checks
- Check whether the joining columns between the two tables have a composite unique index, and create one if the multi-column join was genuinely intended.
Related Errors / Related Topics
- -2857 — "There can be only one dominant composite column in a join list." A related join-column error, about multiple dominant columns rather than a missing composite key.
The joined columns between two tables don't form a composite unique index — create one, or review whether the join was intended.