Re: CREATE AGGREGATE array_cat

2020-11-18 Thread Andres Freund
Hi, On 2020-11-18 19:54:52 -0500, Chapman Flack wrote: > On 11/18/20 19:46, David G. Johnston wrote: > > > I doubt there is any substantial resistance to including such a function > > but it would have to be written in C. > > Would anything have to be written at all, save the CREATE AGGREGATE >

Re: CREATE AGGREGATE array_cat

2020-11-18 Thread Tom Lane
Vik Fearing writes: > On 11/19/20 1:54 AM, Chapman Flack wrote: >> Would anything have to be written at all, save the CREATE AGGREGATE >> suggested in the original message, using the existing array_cat as the >> state transition function? > Nope. As my example showed. But by the same token,

Re: CREATE AGGREGATE array_cat

2020-11-18 Thread Vik Fearing
On 11/19/20 1:54 AM, Chapman Flack wrote: > On 11/18/20 19:46, David G. Johnston wrote: > >> I doubt there is any substantial resistance to including such a function >> but it would have to be written in C. > > Would anything have to be written at all, save the CREATE AGGREGATE > suggested in

Re: CREATE AGGREGATE array_cat

2020-11-18 Thread David G. Johnston
On Wed, Nov 18, 2020 at 5:54 PM Chapman Flack wrote: > On 11/18/20 19:46, David G. Johnston wrote: > > > I doubt there is any substantial resistance to including such a function > > but it would have to be written in C. > > Would anything have to be written at all, save the CREATE AGGREGATE >

Re: CREATE AGGREGATE array_cat

2020-11-18 Thread Chapman Flack
On 11/18/20 19:46, David G. Johnston wrote: > I doubt there is any substantial resistance to including such a function > but it would have to be written in C. Would anything have to be written at all, save the CREATE AGGREGATE suggested in the original message, using the existing array_cat as

Re: CREATE AGGREGATE array_cat

2020-11-18 Thread David G. Johnston
On Wed, Nov 18, 2020 at 5:37 PM Vik Fearing wrote: > On 11/18/20 11:19 PM, David G. Johnston wrote: > > On Wednesday, November 18, 2020, Vlad Bokov wrote: > > > >> Hi, I wonder why there's no function to aggregate arrays by > >> concatenation out of the box? > >> > > > > See array_agg(...) > >

Re: CREATE AGGREGATE array_cat

2020-11-18 Thread Vik Fearing
nted. vik=# select array_agg(a) from (values (array[1]), (array[2])) as v(a); array_agg --- {{1},{2}} (1 row) vik=# CREATE AGGREGATE array_cat (anyarray) vik-# ( vik(# sfunc = array_cat, vik(# stype = anyarray, vik(# initcond = '{}' vik(# ); CREATE AGGREGATE vik=# select arra

Re: CREATE AGGREGATE array_cat

2020-11-18 Thread David G. Johnston
On Wednesday, November 18, 2020, Vlad Bokov wrote: > Hi, I wonder why there's no function to aggregate arrays by > concatenation out of the box? > See array_agg(...) David J.

CREATE AGGREGATE array_cat

2020-11-18 Thread Vlad Bokov
Hi, I wonder why there's no function to aggregate arrays by concatenation out of the box? There is a usual function `array_cat(anyarray, anyarray)`, but it doesn't seamlessly work with grouping. Wouldn't it be natural to have this: CREATE AGGREGATE array_cat (anyarray) (     sfunc = array_cat