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 1tnrV8-002uhQ-IG for pgsql-hackers@arkaria.postgresql.org; Fri, 28 Feb 2025 03:57:28 +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 1tnrV9-00D1vb-6y for pgsql-hackers@arkaria.postgresql.org; Fri, 28 Feb 2025 03:57:25 +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 1tnrV7-00D1vB-SK for pgsql-hackers@lists.postgresql.org; Fri, 28 Feb 2025 03:57:25 +0000 Received: from mail.clear-code.com ([2401:2500:102:3037:153:126:203:179]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tnrV2-0005qI-0v for pgsql-hackers@postgresql.org; Fri, 28 Feb 2025 03:57:22 +0000 Received: from localhost (unknown [IPv6:2404:7a80:9f01:f500:af1b:fa00:91d6:aaa9]) by mail.clear-code.com (Postfix) with ESMTPSA id 5CC2C6858C7; Fri, 28 Feb 2025 12:57:12 +0900 (JST) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.clear-code.com 5CC2C6858C7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=clear-code.com; s=default; t=1740715032; bh=/p3VhEHRbeNouwzdBTVvm1pJLV3MPFt1QH/uE1tdVn0=; h=Date:To:Cc:Subject:From:In-Reply-To:References:From; b=r+5KK7sS8IvZDTOs/0QJWK5jzCwxan68U0tVNYR8nk0Ga6KL6IGrFGPiXdpEl2UDk 90X3aV1JB9KIs7JFA6JHUrrjVVG4JPgNt4Cp0bpkj3Ki0ABlME1sBr77YMpNy0JcfV pdIZEwCoOKgChczRKgC+L2U2fB8VlNz/DM2brg18= Date: Fri, 28 Feb 2025 12:57:09 +0900 (JST) Message-Id: <20250228.125709.1928710773124617999.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: <20250226.110826.297987517588158968.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: 5CC2C6858C7 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 Thu, 27 Feb 2025 15:24:26 -0800, Masahiko Sawada wrote: > Pushed the 0001 patch. Thanks! > Regarding the 0002 patch, I realized we stopped exposing > NextCopyFromRawFields() function: > > --- a/src/include/commands/copy.h > +++ b/src/include/commands/copy.h > @@ -107,8 +107,6 @@ extern CopyFromState BeginCopyFrom(ParseState > *pstate, Relation rel, Node *where > extern void EndCopyFrom(CopyFromState cstate); > extern bool NextCopyFrom(CopyFromState cstate, ExprContext *econtext, > Datum *values, bool *nulls); > -extern bool NextCopyFromRawFields(CopyFromState cstate, > - char ***fields, int *nfields); > > I think that this change is not relevant with the refactoring and > probably we should keep it exposed as extension might be using it. > Considering that we added pg_attribute_always_inline to the function, > does it work even if we omit pg_attribute_always_inline to its > function declaration in the copy.h file? Unfortunately, no. The inline + constant argument optimization requires "static". How about the following? static pg_attribute_always_inline bool NextCopyFromRawFieldsInternal(CopyFromState cstate, char ***fields, int *nfields, bool is_csv) { ... } bool NextCopyFromRawFields(CopyFromState cstate, char ***fields, int *nfields) { return NextCopyFromRawFieldsInternal(cstate, fields, nfields, cstate->opts.csv_mode); } Thanks, -- kou