Teodor today has come with a problem, which can be solved using aggregate for tsvector:
CREATE AGGREGATE tsvector_sum(tsvector) ( SFUNC = tsvector_concat, STYPE = tsvector, INITCOND = '' );
Below is my demonstration:
=# select tsvector_sum( t.fts) from ( select ('1 2 ' || generate_series(3,10,1))::tsvector as fts ) as t; tsvector_sum ------------------------------------------ '1' '2' '3' '4' '5' '6' '7' '8' '9' '10'