Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for custom aggregates #31

Open
vekonypeter opened this issue Oct 18, 2024 · 0 comments
Open

support for custom aggregates #31

vekonypeter opened this issue Oct 18, 2024 · 0 comments

Comments

@vekonypeter
Copy link

for example:

create or replace function array_union_step (s anyarray, n anyarray) returns anyarray
   as $$ select s || n; $$
   language sql immutable leakproof parallel safe;

create or replace function array_union_final (s anyarray) returns anyarray
  as $$
    select array_agg(i order by i) from (
      select distinct unnest(x) as i from (values(s)) as v(x)
    ) as w where i is not null;
  $$
  language sql immutable leakproof parallel safe;

create or replace aggregate array_union (anyarray) (
  sfunc = array_union_step,
  stype = anyarray,
  finalfunc = array_union_final,
  initcond = '{}',
  parallel = safe
);

comment on function array_union is
    E'Aggregate function to compute the union of multiple arrays';

the two "helper" functions (array_union_step and array_union_final) are recognized and diffed correctly, but the array_union aggregate is not, the tool just logs the fact that the statement is skipped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant