Re: Partial aggregates pushdown - Mailing list pgsql-hackers

From Alexander Pyhalov
Subject Re: Partial aggregates pushdown
Date
Msg-id a22d250b61a3faa425864573364db66d@postgrespro.ru
Whole thread Raw
In response to Re: Partial aggregates pushdown  (Bruce Momjian <bruce@momjian.us>)
Responses Re: Partial aggregates pushdown
List pgsql-hackers
Bruce Momjian писал(а) 2024-06-04 20:12:
> On Mon, May 27, 2024 at 09:30:59PM +0000, 
> Fujii.Yuki@df.MitsubishiElectric.co.jp wrote:
>> Hi Mr. Pyhalov.
>> 
>> Sorry for the late reply.
>> Thank you for your modification and detailed review.
>> I attach a fixed patch, have been not yet rebased.
> 
> I know this patch was discussed at the Vancouver conference.  What are
> the open issues?  I know of several:
> 
> *  add tests that were requested by Fujii-san and now posted by
>    Alexander Pyhalov
> *  Where is the documentation?  I know the original patch had some, and
>    I improved it, but it seems to be missing.
> *  Passes unsafe binary data from the foreign server.
> 
> Can someone show me where that last item is in the patch, and why can't
> we just pass back values cast to text?

Hi.

In finalize_aggregate() when we see partial aggregate with 
peragg->aggref->aggtranstype = INTERNALOID
we call aggregate's serialization function and return it as bytea.

The issue is that this internal representation isn't guaranteed to be 
compatible between servers
of different versions (or architectures?). So, likely, we instead should 
have called some export function for aggregate
and later - some import function on postgres_fdw side. It doesn't matter 
much, what this export function
generates - text, json or some portable binary format,
1) export/import functions should just "understand" it,
2) it should be a stable representation.
-- 
Best regards,
Alexander Pyhalov,
Postgres Professional



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: pg_parse_json() should not leak token copies on failure
Next
From: Pavel Stehule
Date:
Subject: Re: Schema variables - new implementation for Postgres 15