Informix Error -25857: Invalid usage of DISTINCT aggregate in this context.
Cause and resolution
Invalid usage of DISTINCT aggregate in this context.
DISTINCT is only allowed for the following OLAP aggregate functions:
SUM(), AVG(), COUNT(), MIN(), MAX(), RANGE(), VARIANCE(), STDEV()
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-25857 fires when DISTINCT is used with an OLAP aggregate function that doesn't support
it — per the official guidance, DISTINCT is only allowed for SUM(), AVG(),
COUNT(), MIN(), MAX(), RANGE(), VARIANCE(), and STDEV().
DISTINCTused with an OLAP aggregate outside this list, per the official guidance — the direct, only cause.
Solutions / Resolution
- Remove
DISTINCT, or restructure the query around one of the supported aggregates, per the official guidance —SUM,AVG,COUNT,MIN,MAX,RANGE,VARIANCE,STDEV.
Examples
N/A
No specific triggering statement is documented beyond DISTINCT on an unsupported
aggregate.
Diagnostic Checks
- Check which aggregate function
DISTINCTis applied to, and confirm it's one of the eight supported functions.
Related Errors / Related Topics
- -25858 — "DISTINCT aggregate can not have ORDER BY clause or window frame extent."
A related
DISTINCT-aggregate restriction, onORDER BY/frame extents rather than which aggregates supportDISTINCT.
DISTINCT was used with an OLAP aggregate that doesn't support it — use one of SUM,
AVG, COUNT, MIN, MAX, RANGE, VARIANCE, STDEV.