Re: Handling memory contexts in aggregate function invoking other built-in aggregate functions

From: Matt Magoffin <postgresql(dot)org(at)msqr(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Handling memory contexts in aggregate function invoking other built-in aggregate functions
Date: 2021-12-04 21:55:38
Message-ID: A49268B1-0ED2-48D8-98C1-6619AC825B95@msqr.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 5/12/2021, at 9:04 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> So that probably means that you weren't careful about allocating your
> own state data in the long-lived context (agg_context), and so it
> got freed between calls.

It turns out I wasn’t careful about setting isnull on the passed in state argument. After I fixed that [1] everything appears to be running smoothly!

— m@

[1] https://github.com/SolarNetwork/aggs_for_vecs/commit/a734ab211f9660f8a5a3d13870f089b46df56e7c

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dilip Kumar 2021-12-05 05:25:15 Re: Max connections reached without max connections reached
Previous Message Laurenz Albe 2021-12-04 21:43:48 Re: libpq: Which functions may hang due to network issues?