自定义聚合函数 parallel = safe 在 postgres 13.3 中生成语法

Custom aggregate function parallel = safe produces syntax in postgres 13.3

这会导致并行语法错误

CREATE AGGREGATE public.first (
        sfunc    = public.first_agg,
        basetype = anyelement,
        stype    = anyelement,
        parallel = safe
);

可能是因为这个? https://www.postgresql-archive.org/reate-parallel-aggregate-td5923553.html

我不知道是否有语法更改或其他内容,如果有,新语法是什么?

您可以使用 the new or the old syntax。新版没有BASETYPE,旧版没有PARALLEL。在新语法中,您应该将基本类型定义为 arg_data_type:

CREATE AGGREGATE public.first(anyelement) (
        sfunc    = public.first_agg,
        stype    = anyelement,
        parallel = safe
);