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 1ubaXK-002h63-Ou for pgsql-hackers@arkaria.postgresql.org; Tue, 15 Jul 2025 07:57:15 +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 1ubaWK-000KCh-7g for pgsql-hackers@arkaria.postgresql.org; Tue, 15 Jul 2025 07:56:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ubaUe-000H1E-Co for pgsql-hackers@lists.postgresql.org; Tue, 15 Jul 2025 07:54:29 +0000 Received: from mail.clear-code.com ([153.126.203.179]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ubaUa-007pyR-0B for pgsql-hackers@postgresql.org; Tue, 15 Jul 2025 07:54:27 +0000 Received: from localhost (unknown [IPv6:2404:7a80:9f01:f500:5950:362a:f311:d0d2]) by mail.clear-code.com (Postfix) with ESMTPSA id 989086E3B04; Tue, 15 Jul 2025 16:54:15 +0900 (JST) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.clear-code.com 989086E3B04 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=clear-code.com; s=default; t=1752566055; bh=YuNEgdvzPQSyLdOGQmBRBN8JWiCy8LMB+ZgximxtCGk=; h=Date:To:Cc:Subject:From:In-Reply-To:References:From; b=GnxPgXBT1cSWoz96zrZBOKyGRs0MyjimUxKrraearoKTRIycl6eonC9vDulAKywcM okIEKMsOPVr1+mlPsqvdyqTMS4mbciYXgjImTOTCEH6Z+WN/aY0trAZvqRbTKLFvzm aoZv84krLCmJUiZQWpfuk2qjZadItivY3znGR1lU= Date: Tue, 15 Jul 2025 16:54:13 +0900 (JST) Message-Id: <20250715.165413.1502624024677287358.kou@clear-code.com> To: sawada.mshk@gmail.com Cc: michael@paquier.xyz, david.g.johnston@gmail.com, tgl@sss.pgh.pa.us, zhjwpku@gmail.com, pgsql-hackers@postgresql.org Subject: Re: Make COPY format extendable: Extract COPY TO format implementations From: Sutou Kouhei In-Reply-To: <20250714.173803.865595983884510428.kou@clear-code.com> References: <20250714.173803.865595983884510428.kou@clear-code.com> X-Mailer: Mew version 6.8 on Emacs 30.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 989086E3B04 X-Rspamd-Server: mail.clear-code.com X-Spamd-Result: default: False [2.90 / 999.00]; SUSPICIOUS_RECIPS(1.50)[]; MID_CONTAINS_FROM(1.00)[]; MV_CASE(0.50)[]; MIME_GOOD(-0.10)[text/plain]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; ASN(0.00)[asn:2518, ipnet:2404:7a80::/29, country:JP]; TAGGED_RCPT(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_ZERO(0.00)[0]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; FREEMAIL_CC(0.00)[paquier.xyz,gmail.com,sss.pgh.pa.us,postgresql.org]; FROM_HAS_DN(0.00)[]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; RCPT_COUNT_FIVE(0.00)[6] X-Rspamd-Action: no action List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, In <20250714.173803.865595983884510428.kou@clear-code.com> "Re: Make COPY format extendable: Extract COPY TO format implementations" on Mon, 14 Jul 2025 17:38:03 +0900 (JST), Sutou Kouhei wrote: >> I've reviewed the 0001 and 0002 patches. The API implemented in the >> 0002 patch looks good to me, but I'm concerned about the capsulation >> of copy state data. With the v42 patches, we pass the whole >> CopyToStateData to the extension codes, but most of the fields in >> CopyToStateData are internal working state data that shouldn't be >> exposed to extensions. I think we need to sort out which fields are >> exposed or not. That way, it would be safer and we would be able to >> avoid exposing copyto_internal.h and extensions would not need to >> include copyfrom_internal.h. > In general, I agree that we should export only needed > information. > > How about adding accessors instead of splitting > Copy{From,To}State to Copy{From,To}ExecutionData? If we use > the accessors approach, we can export only needed > information step by step without breaking ABI. Another idea: We'll add Copy{From,To}State::opaque eventually. (For example, the v40-0003 patch includes it.) How about using it to hide fields only for built-in formats? Thanks, -- kou