Re: Properly handling aggregate in nested function call

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Properly handling aggregate in nested function call
Дата
Msg-id 559031.1639522278@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Properly handling aggregate in nested function call  (Matt Magoffin <postgresql.org@msqr.us>)
Ответы Re: Properly handling aggregate in nested function call  (Matt Magoffin <postgresql.org@msqr.us>)
Re: Properly handling aggregate in nested function call  (Matt Magoffin <postgresql.org@msqr.us>)
Список pgsql-general
Matt Magoffin <postgresql.org@msqr.us> writes:
> Any ideas what I’m doing wrong here? The source is available here:

> https://github.com/SolarNetwork/aggs_for_vecs/blob/9e742cdc32a113268fd3c1f928c8ac724acec9f5/vec_agg_mean.c

Hmm, I think you're abusing the ArrayBuildState API.  In particular,
what guarantees that the astate->dvalues and astate->dnulls arrays
are long enough for what you're stuffing into them?  You should
probably palloc temp arrays right here and then use construct_md_array
directly instead of dealing with an ArrayBuildState.

Also, I wonder what happens when state->vec_counts[i] is zero.
That's seemingly not your problem right now, since the ereport(NOTICE)
is being reached; but it sure looks like trouble waiting to happen.

            regards, tom lane



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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Why can't I have a "language sql" anonymous block?
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: Why can't I have a "language sql" anonymous block?