Hello!
In postgresql 16 and 17 using array_agg with filter where gives an error, while in postgres 15 exact same query works.
This is minimal sample for reproducing:
create table test (id int, data jsonb);
insert into test (id, data) values
(1, '{"a": null}'),
(2, '{"a": "2"}'),
(3, '{"a": "2"}'),
(4, '{"a": ""}');
select array_agg(distinct (data->>'a')::int) filter (where data->>'a' is not null and data->>'a' != '')
from test;
Last query in pg16 or pg17 returns ERROR #22P02 invalid input syntax for type integer: ""
In pg15 it returns correct result {2}
wbr, Ferossa.