Properly mark NULL returns in numeric aggregates

Поиск
Список
Период
Сортировка
От Jesse Zhang
Тема Properly mark NULL returns in numeric aggregates
Дата
Msg-id CAGf+fX4ZB9=5eUaHdxUWA7au8KOd4Mychc-jzW5htbAAGFXGWw@mail.gmail.com
обсуждение исходный текст
Ответы Re: Properly mark NULL returns in numeric aggregates
Список pgsql-hackers
Hi hackers,

We found that several functions -- namely numeric_combine,
numeric_avg_combine, numeric_poly_combine, and int8_avg_combine -- are
returning NULL without signaling the nullity of datum in fcinfo.isnull.
This is obscured by the fact that the only functions in core (finalfunc
for various aggregates) that those return values feed into happen to
tolerate (or rather, not quite distinguish) zero-but-not-NULL trans
values.

In Greenplum, this behavior becomes problematic because Greenplum
serializes internal trans values before spilling the hash table. The
serial functions (numeric_serialize and friends) are strict functions
that will blow up when they are given null (either in the C sense or the
SQL sense) inputs.

In Postgres if we change hash aggregation in the future to spill the
hash table (vis-à-vis the input tuples), this issues would manifest
itself in the final aggregate because we'll serialize the combined (and
likely incorrectly null) trans values.

Please find attached a small patch fixing said issue.  Originally
reported by Denis Smirnov over at
https://github.com/greenplum-db/gpdb/pull/9878

Cheers,
Jesse and Deep

Вложения

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

Предыдущее
От: Michail Nikolaev
Дата:
Сообщение: Re: Thoughts on "killed tuples" index hint bits support on standby
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: more ALTER .. DEPENDS ON EXTENSION fixes