Informix Error -25861: The types of default expression and expression of LEAD, LAG are not compatible.
Cause and resolution
The types of default expression and expression of LEAD, LAG are not compatible.
The default expression type shall be compaitble with LEAD, LAG window expression type.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-25861 fires when LEAD()/LAG()'s default-value expression has a type incompatible with
its main expression's type — per the official guidance.
- A
LEAD()/LAG()default expression whose type doesn't match the function's main expression type, per the official guidance — the direct, only cause.
Solutions / Resolution
- Change the default expression's type to be compatible with the
LEAD/LAGexpression's type, per the official guidance.
Examples
Incompatible default expression type
SELECT customer_id, LEAD(order_date, 1, 'none') OVER (ORDER BY order_date) FROM orders;
-- -25861: 'none' (CHAR) is incompatible with order_date (DATE)
Corrected
SELECT customer_id, LEAD(order_date, 1, DATE('01/01/1900')) OVER (ORDER BY order_date)
FROM orders;
Diagnostic Checks
- Check the data types of
LEAD/LAG's main expression and its default-value expression, and make them compatible.
Related Errors / Related Topics
- -25860 — "The offset of the LEAD, LAG window function is invalid." A related
LEAD/LAGerror, on the offset argument rather than the default-expression type.
LEAD/LAG's default-value expression had an incompatible type — match it to the main
expression's type.