Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r7ihn-006RYK-9c for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Nov 2023 20:59:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1r7ihl-00GZ1P-Bj for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Nov 2023 20:59:45 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r7ihl-00GZ1H-27 for pgsql-hackers@lists.postgresql.org; Mon, 27 Nov 2023 20:59:45 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r7ihi-007exc-GJ for pgsql-hackers@postgresql.org; Mon, 27 Nov 2023 20:59:43 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 3ARKxTR94010200; Mon, 27 Nov 2023 15:59:30 -0500 From: Tom Lane To: Robert Haas cc: "Fujii.Yuki@df.MitsubishiElectric.co.jp" , Alexander Pyhalov , Bruce Momjian , PostgreSQL-development , "Finnerty, Jim" , Andres Freund , Tomas Vondra , Julien Rouhaud , Daniel Gustafsson Subject: Re: Partial aggregates pushdown In-reply-to: References: <8175ddeb6d417d8a1f91e667fef77abf@postgrespro.ru> Comments: In-reply-to Robert Haas message dated "Mon, 27 Nov 2023 15:03:22 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4010198.1701118769.1@sss.pgh.pa.us> Date: Mon, 27 Nov 2023 15:59:29 -0500 Message-ID: <4010199.1701118769@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Robert Haas writes: > Also, I want to make one other point here about security and > reliability. Right now, there is no way for a user to feed arbitrary > data to a deserialization function. Since serialization and > deserialization functions are only used in the context of parallel > query, we always know that the data fed to the deserialization > function must have come from the serialization function on the same > machine. Nor can users call the deserialization function directly with > arbitrary data of their own choosing, because users cannot call > functions that take or return internal. But with this system, it > becomes possible to feed arbitrary data to a deserialization function. Ouch. That is absolutely horrid --- we have a lot of stuff that depends on users not being able to get at "internal" values, and it sounds like the current proposal breaks all of that. Quite aside from security concerns, there is no justification for assuming that the "internal" values used on one platform/PG version are identical to those used on another. So if the idea is to ship back "internal" values from the remote server to the local one, I think it's basically impossible to make that work. Even if the partial-aggregate serialization value isn't "internal" but some more-narrowly-defined type, it is still an internal implementation detail of the aggregate. You have no right to assume that the remote server implements the aggregate the same way the local one does. If we start making such an assumption then we'll be unable to revise the implementation of an aggregate ever again. TBH, I think this entire proposal is dead in the water. Which is sad from a performance standpoint, but I can't see any way that we would not regret shipping a feature that makes such assumptions. regards, tom lane