Informix Error -9400: User-defined aggregate <aggregate-name> already exists. </aggregate-name>
Cause and resolution
User-defined aggregate <aggregate-name> already exists. </aggregate-name>
The name given already exists in your database, either as an aggregate name or as the name of a routine. (You cannot have an aggregate and a routine with the same name.)
Change your CREATE AGGREGATE statement to give the aggregate a unique name.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-9400 fires when a CREATE AGGREGATE statement's name already exists in the database, either as an aggregate or as the name of a routine — per the official guidance.
- The name is already used by another aggregate or a routine, per the official guidance — the direct, only cause; an aggregate and a routine can't share a name.
Solutions / Resolution
- Change the CREATE AGGREGATE statement to give the aggregate a unique name, per the official guidance.
Examples
Reusing an existing name
CREATE AGGREGATE sum_new_type WITH (...); -- -9400 if sum_new_type already exists
Corrected
CREATE AGGREGATE sum_new_type_v2 WITH (...);
Diagnostic Checks
- Check the system catalog for the existing aggregate or routine using the name, and choose an unused name.
Related Errors / Related Topics
- -9401 — "Cannot re-define or drop builtin aggregate
." A related aggregate-naming error, on redefining a system-defined aggregate rather than reusing a name.
The aggregate name is already used by another aggregate or routine — choose a unique name.