array_not_nulls(array_agg(case when type='A' then link end ))as ar_a, array_not_nulls(array_agg(case when type='B' then link end ))as ar_b, array_not_nulls(array_agg(case when type NOT IN ('A', 'B') then link end)) as ar_others
Yeah. I'm not sure why I didn't tend toward the array_agg approach since I have made use of it previously. It cleans up a bit but not as much as I was hoping - but also not seeing. The preponderance of case statements
and array slicing is still present. I image trying to write some kind of "shift" function but that doesn't mesh well with set theory; it seems to be a procedural concept which I suspect would be considerably worse performing.
Thanks for the suggestion and once I get back on that project I'm intended to do a barebones performance comparison of the two which I'll follow up with.