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 1sEj3I-003Ekq-4S for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Jun 2024 05:19:14 +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 1sEj3H-005EEd-T8 for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Jun 2024 05:19:11 +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 1sEj3H-005EEU-Fs for pgsql-hackers@lists.postgresql.org; Wed, 05 Jun 2024 05:19:11 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sEj3E-003WpP-69 for pgsql-hackers@postgresql.org; Wed, 05 Jun 2024 05:19:10 +0000 Received: from mail.postgrespro.ru (unknown [192.168.2.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: a.pyhalov@postgrespro.ru) by mail.postgrespro.ru (Postfix/587) with ESMTPSA id 4C24CE20E98; Wed, 5 Jun 2024 08:19:04 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1717564744; bh=tsbIKe8lTnA8Ho9CJDuhrE4y8kYlEtt3fvJsASPfd+A=; h=Date:From:To:Cc:Subject:In-Reply-To:References:User-Agent: Message-ID:From; b=bb/x4+QfHZ0CXLncZOYBn0nLJ103JVsu5SiMsvG50HLQWmWyAvi3dwavfpo+sNeRH DuvMgfpcgSlz6nFBqcskKgPetW1nz0coGfWfW4EQymu4HTBEdK62oUnfgLhVCsD9Yo HoxD6R8V46XylkdTcz9T6huIOIY/rxIMkQOUFUS0xz1SbcxhfyLCrFTECSReEXQF+Y DEDG6cS74Ph70plOBghK3CvhEdBNOXMqW4i5GraZxtX4tzR4nZHc61/qOl6DUDliYG 6tFUWCTK2+QPxUBrW6TZS6/yWBxxwuVNBwS0Y/6kjAXJzozYPE1lXQZLBjrfAn6bdp cxrvJowx4Pbtg== MIME-Version: 1.0 Date: Wed, 05 Jun 2024 08:19:04 +0300 From: Alexander Pyhalov To: Bruce Momjian Cc: "Fujii.Yuki@df.MitsubishiElectric.co.jp" , Robert Haas , PostgreSQL-development , Tom Lane , Stephen Frost , Andres Freund , Tomas Vondra , Julien Rouhaud , Daniel Gustafsson , vignesh C Subject: Re: Partial aggregates pushdown In-Reply-To: References: <31ab8f7b91cef6e837b3e31ea1e35a9a@postgrespro.ru> User-Agent: Roundcube Webmail/1.6.7 Message-ID: X-Sender: a.pyhalov@postgrespro.ru Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-KSMG-AntiPhishing: NotDetected X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.1.0.7854, bases: 2024/06/04 19:50:00 #25447873 X-KSMG-AntiVirus-Status: NotDetected, skipped X-KSMG-LinksScanning: not scanned, disabled by settings X-KSMG-Message-Action: skipped X-KSMG-Rule-ID: 1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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