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 1tfZtM-003Rij-Be for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Feb 2025 07:32:13 +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 1tfZtL-00CYSd-4n for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Feb 2025 07:32: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 1tfZtK-00CYSV-2Q for pgsql-hackers@lists.postgresql.org; Wed, 05 Feb 2025 07:32:10 +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 1tfZtF-003GxT-2x for pgsql-hackers@postgresql.org; Wed, 05 Feb 2025 07:32:08 +0000 Received: from localhost (unknown [IPv6:2404:7a80:9f01:f500:af1b:fa00:91d6:aaa9]) by mail.clear-code.com (Postfix) with ESMTPSA id 6F29B5624ED; Wed, 5 Feb 2025 16:31:58 +0900 (JST) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.clear-code.com 6F29B5624ED DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=clear-code.com; s=default; t=1738740718; bh=sZN71lZBYSnAKGH0+cQx5V5RvcdxkQRSfXbXfJvAZvU=; h=Date:To:Cc:Subject:From:In-Reply-To:References:From; b=DQ8AHeaBhtSRKGuGfniNIu/s3l+CHYn/YwSVyDqa6eraduN/unsNKvzs2D1ly/fjj sE5WG26qv0506kLY4NPvk+lhy2+/yhUkFB79Tpl9u+PWhqBfO36aslDgkzIqgdfMiF CjIX2+JQgdVw8JSollibJ2ycnJoQVVJ5JxRccV7c= Date: Wed, 05 Feb 2025 16:31:56 +0900 (JST) Message-Id: <20250205.163156.1535621111236702609.kou@clear-code.com> To: v.popolitov@postgrespro.ru Cc: sawada.mshk@gmail.com, zhjwpku@gmail.com, michael@paquier.xyz, pgsql-hackers@postgresql.org Subject: Re: Make COPY format extendable: Extract COPY TO format implementations From: Sutou Kouhei In-Reply-To: References: <20250204.152927.1922290693174479861.kou@clear-code.com> X-Mailer: Mew version 6.8 on Emacs 29.4 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Rspamd-Server: mail.clear-code.com X-Rspamd-Queue-Id: 6F29B5624ED X-Rspamd-Action: no action 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]; FREEMAIL_CC(0.00)[gmail.com,paquier.xyz,postgresql.org]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; ARC_NA(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; ASN(0.00)[asn:2518, ipnet:2404:7a80::/29, country:JP]; TAGGED_RCPT(0.00)[]; RCVD_COUNT_ZERO(0.00)[0]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[]; TO_DN_NONE(0.00)[]; RCPT_COUNT_FIVE(0.00)[5] 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 Tue, 04 Feb 2025 17:46:10 +0700, Vladlen Popolitov wrote: > I think, in case of USING PostgreSQL kernel will call corresponding > handler, > and it looks secure - the same as for table and index methods > handlers. We use similar approach that is used by table sampling method. We can use a new table sampling method by just adding a "method_name(internal) RETURNS tsm_handler" function. Is it not secure too? > If you add extensibility, than every handler will be the > extension, that can handle one or more formats. Hmm. It may be a needless extensibility. Is it useful? I feel that it increases complexity when we implement a custom format handler. We can just implement one handler per custom format. If we want to share implementation details in multiple handlers, we can just share internal C functions. If we require one handler per custom format, it'll simpler than one handler for multiple custom formats. >>> it assumes some SetOptions interface, that defines >>> an options structure according to the new method requirements. >> Sorry. I couldn't find the SetOptions interface in source >> code. I found only AT_SetOptions. Did you mean it by "some >> SetOptions interface"? > Yes. >> I'm familiar with only access method. It has >> IndexAmRoutine::amoptions. Is it a SetOptions interface >> example? > Yes. I think, it would be compatible with other modules > of source code and could use the same code base to process > options of COPY TO/FROM Thanks. I thought that there is a common interface pattern for SetOptions. But it seems that it's a feature that is implemented in many extension points. If we implement custom options support eventually, does it satisfy the "SetOptions interface"? Thanks, -- kou