Im trying to create a custom rollback for an aggregated function in postgres.
The reason is that there is a bug in Liquibase that prevents it from droppen an aggregated function.
The command that I’m running is dropAll.
My changelog file:
<changeSet author="klaus (generated)" id="1706465573317-317">
<pro:createFunction functionName="sum" path="../objects/function/sum-756b1daf.sql" relativeToChangelogFile="true"/>
<!--rollback>
DROP AGGREGATE dev.sum(boolean)
</rollback-->
</changeSet>
sql file:
CREATE AGGREGATE dev.sum(boolean) (
SFUNC = sumboolmaj,
STYPE = integer,
FINALFUNC = sumboolfin,
INITCOND = 0
);
-- rollback drop aggregate dev.sum(boolean);
console log error:
[2024-02-09 11:18:50] SEVERE [liquibase.command] Error occurred during dropAll: ERROR: “dev.sum” is an aggregate function
Hint: Use DROP AGGREGATE to drop aggregate functions. [Failed SQL: (0) DROP FUNCTION “dev”.“sum”]
It is possible that not all objects were dropped.
liquibase.exception.DatabaseException: ERROR: “dev.sum” is an aggregate function
Hint: Use DROP AGGREGATE to drop aggregate functions. [Failed SQL: (0) DROP FUNCTION “dev”.“sum”]