cal I pass arguments directly to final function in aggregates

Поиск
Список
Период
Сортировка
От Nicklas Avén
Тема cal I pass arguments directly to final function in aggregates
Дата
Msg-id 51980B67.3040803@jordogskog.no
обсуждение исходный текст
Ответ на Undefined reference with libpq on Visual Studio 2012  (David Demelier <demelier.david@gmail.com>)
Ответы Re: cal I pass arguments directly to final function in aggregates  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hallo

I am trying to create an aggregate function.

One of the arguments is static and is not needed until the final function.
From the doc I see that the final function " must take a single argument of type state_data_type"

Is it not possible to just pass this arguments directly to the final function?

I was looking at string_agg but that was doing all the processing in the SFUNC if I understand it right.

But to use it as example, if it instead would have collected all strings in an array and added the delimiter in the final function, would that be possible?

I would expect the definition of the aggregate to look something like:

CREATE AGGREGATE string_agg(text, text) (
  SFUNC=string_agg_transfn($1),
  STYPE=internal,
  FINALFUNC=string_agg_finalfn($2)
);

Am I missing something or am I just thinking in irregular circles (that happens now and then)


Best Regards

Nicklas Avén

В списке pgsql-general по дате отправления:

Предыдущее
От: hubert depesz lubaczewski
Дата:
Сообщение: Re: Why does row estimation on nested loop make no sense to me
Следующее
От: Tom Lane
Дата:
Сообщение: Re: cal I pass arguments directly to final function in aggregates