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 1tfl2a-004rRu-7G for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Feb 2025 19:26: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 1tfl2Z-0006b9-3a for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Feb 2025 19:26:27 +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 1tfl2Y-0006b1-Nk for pgsql-hackers@lists.postgresql.org; Wed, 05 Feb 2025 19:26:26 +0000 Received: from fout-a7-smtp.messagingengine.com ([103.168.172.150]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tfl2W-003MyS-1m for pgsql-hackers@postgresql.org; Wed, 05 Feb 2025 19:26:25 +0000 Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfout.phl.internal (Postfix) with ESMTP id 1BEC7138017E; Wed, 5 Feb 2025 14:26:24 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Wed, 05 Feb 2025 14:26:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1738783584; x=1738869984; bh=w wsbcteOXyfOHvfTmDqX50tCA0rydH6loKqOvYCp3P8=; b=SE8MzdmdmMbVcWPn8 0eTy72I4WxNF+5bA/fEW15WJWrFwtGPnRQZs4wtuCgINbdV874RD3j1FbkR9p6wt SzxbkAoYKpRsv63VN52fnXXYB0XVJnQUyV/CAFPj+cwTm+GB65aPE0bilUAKPcWM FgytXBhTGB7KsJTRPidll14yVN8trpiDygJLk3CDwwSIH2nitm31gEC6lHLkXrwJ kDoCyx9SpIDYjtGi4Xi3sE70xB9jWc2fwsA95sKYSt9w9SDl59oOVSJWa6h1JiFh dv5y9VhcWD8ulGE6R2NTE2uaE6o/h1aqPZ8TNsE3BY9NeoJQH+ziLDO2+9hzLZof 1FN7w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvgeeftdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpeffhffvvefukfggtggugfgjsehtkeertddttdej necuhfhrohhmpemllhhvrghrohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvh hhrdhnohdqihhprdhorhhgqeenucggtffrrghtthgvrhhnpedvheeuffehgfeukeeufeeh hefghfeugfefudekjeevudffgeffkeegffffveegheenucffohhmrghinhepvghnthgvrh hprhhishgvuggsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehm rghilhhfrhhomheprghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrghdpnhgspg hrtghpthhtohepiedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepkhhouhestghl vggrrhdqtghouggvrdgtohhmpdhrtghpthhtohepshgrfigruggrrdhmshhhkhesghhmrg hilhdrtghomhdprhgtphhtthhopeiihhhjfihpkhhusehgmhgrihhlrdgtohhmpdhrtghp thhtohepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihiidprhgtphhtthhopehvrdhpoh hpohhlihhtohhvsehpohhsthhgrhgvshhprhhordhruhdprhgtphhtthhopehpghhsqhhl qdhhrggtkhgvrhhssehpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 5 Feb 2025 14:26:22 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1738783580; bh=uO4sKxZ7JehACunirItwiAzN97I4y0JSWprob9PD2b8=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=NlV/OE3sLvp5myJGPaO1pBlmqCffFUs6ra4Q2oP9BELsPYSkuW5dvS6+JuC0Jse7K A+SSvE2jzRoXqIy/4aNsg8kJwQx4FD+zZwI6PsaMwXWV05090iU7RiY5AZ7s8QgwyG bF2syaMfj6azQzBoyaDlSwJCM0W41hDSwHykUaO9axz4gIwSyYDZrurjgeUqZ0vVCf AB9ZrMOmEa61UfbBqfqU1Pviuz1U+0G/S/uu4PUIK25NdnGwBJfD/xw68iL2JKVgj7 ULloK8xzKo9VajURu0Z7kNBH5ghpOgI/+I4IVfoxCG9RxLJ8v7fEKIFWfWcjOp1MOG ZMJ5e5BkM8VHA== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id A8D1F90; Wed, 5 Feb 2025 20:26:20 +0100 (CET) Date: Wed, 5 Feb 2025 20:26:20 +0100 From: =?utf-8?Q?=C3=81lvaro?= Herrera To: Masahiko Sawada Cc: Vladlen Popolitov , Sutou Kouhei , zhjwpku@gmail.com, michael@paquier.xyz, pgsql-hackers@postgresql.org Subject: Re: Make COPY format extendable: Extract COPY TO format implementations Message-ID: <202502051926.sqnaa24c4vp7@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2025-Feb-05, Masahiko Sawada wrote: > I think that the patch needs to check if the function's result type is > COPY_HANDLEROID by using get_func_rettype(), before calling it. But > with this check, we can prevent arbitrary functions from being called > via COPY. Why do we need to extend CREATE ACCESS METHOD too for that > purpose? It's a nicer UI than a bare CREATE FUNCTION, but perhaps it is overkill. IIRC the reason we require CREATE ACCESS METHOD for table AMs is so that we acquire a pg_am entry with an OID that can be referenced from elsewhere, for instance you can't drop an AM if tables are using it; but you can't use COPY in rules or anything like that that's going to be stored permanently. Perhaps you're right that we don't need this for extensible COPY FORMAT. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/