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 1to8NV-006bna-1D for pgsql-hackers@arkaria.postgresql.org; Fri, 28 Feb 2025 21:58:42 +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 1to8NW-0003Fw-1r for pgsql-hackers@arkaria.postgresql.org; Fri, 28 Feb 2025 21:58:40 +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 1to8NU-0003FK-Ul for pgsql-hackers@lists.postgresql.org; Fri, 28 Feb 2025 21:58:40 +0000 Received: from mail.clear-code.com ([2401:2500:102:3037: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 1to8NM-000FPG-33 for pgsql-hackers@postgresql.org; Fri, 28 Feb 2025 21:58:37 +0000 Received: from localhost (unknown [IPv6:2404:7a80:9f01:f500:acd0:2aa3:7b08:7206]) by mail.clear-code.com (Postfix) with ESMTPSA id 31C5A685C62; Sat, 1 Mar 2025 06:58:23 +0900 (JST) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.clear-code.com 31C5A685C62 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=clear-code.com; s=default; t=1740779903; bh=kBaFdYQwA4Wc3Mzm4vYkGNXDMPmkImmzgd7L66X6udE=; h=Date:To:Cc:Subject:From:In-Reply-To:References:From; b=SKCAMHyIpEIVvfjNuz0awZ7klMaOL3vh+7ONGIzuV5qulsyv9q1PLGYZR565bqLiT 7buL8Ny/TXn08Ncr+rX7pSkCY5bjf9hYkLanKcOFGwgFQr712Yq2Ek65rvCBdlcm5z QtzSNfNqo8AB048mNthyVwgOS/OYJeDgGA46UG0w= Date: Sat, 01 Mar 2025 06:58:21 +0900 (JST) Message-Id: <20250301.065821.2101946731315576357.kou@clear-code.com> To: sawada.mshk@gmail.com Cc: michael@paquier.xyz, zhjwpku@gmail.com, pgsql-hackers@postgresql.org Subject: Re: Make COPY format extendable: Extract COPY TO format implementations From: Sutou Kouhei In-Reply-To: References: <20250228.125709.1928710773124617999.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: 31C5A685C62 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]; TAGGED_RCPT(0.00)[]; ARC_NA(0.00)[]; ASN(0.00)[asn:2518, ipnet:2404:7a80::/29, country:JP]; RCVD_COUNT_ZERO(0.00)[0]; MIME_TRACE(0.00)[0:+]; FREEMAIL_TO(0.00)[gmail.com]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; FREEMAIL_CC(0.00)[paquier.xyz,gmail.com,postgresql.org]; FROM_EQ_ENVFROM(0.00)[]; TO_DN_NONE(0.00)[]; RCPT_COUNT_THREE(0.00)[4] X-Rspamd-Action: no action List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, In "Re: Make COPY format extendable: Extract COPY TO format implementations" on Fri, 28 Feb 2025 11:50:39 -0800, Masahiko Sawada wrote: > I initially thought it would be acceptable to stop > NextCopyFromRawFields exposed since NextCopyFrom() could serve as an > alternative. For example, the NextCopyFromRawFields() function was > originally exposed in commit 8ddc05fb01ee2c primarily to support > extension modules like file_fdw but file_fdw wasn't utilizing this > API. I pushed the patch without the above change. Unfortunately, this > commit subsequently broke file_text_array_fdw[1] and made BF animal > crake unhappy[2]. > > [1] https://github.com/adunstan/file_text_array_fdw > [2] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=crake&dt=2025-02-28%2018%3A47%3A02 Thanks for the try! > Upon examining file_text_array_fdw more closely, I realized that > NextCopyFrom() may not be a suitable replacement for > NextCopyFromRawFields() in certain scenarios. Specifically, > NextCopyFrom() assumes that the caller has prior knowledge of the > source data's column count, making it inadequate for cases where > extensions like file_text_array_fdw need to construct an array of > source data with an unknown number of columns. In such situations, > NextCopyFromRawFields() proves to be more practical. Given these > considerations, I'm now leaning towards implementing the proposed > change. Thoughts? You suggest that we re-export NextCopyFromRawFields() (as a wrapper of static inline version) for backward compatibility, right? It makes sense. We should keep backward compatibility because there is a use-case of NextCopyFromRawFields(). Thanks, -- kou