Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oiNxJ-0005x9-2U for pgsql-committers@arkaria.postgresql.org; Tue, 11 Oct 2022 22:42:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oiNxH-0005om-6L for pgsql-committers@arkaria.postgresql.org; Tue, 11 Oct 2022 22:42:31 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oiNxF-0005od-F5 for pgsql-committers@lists.postgresql.org; Tue, 11 Oct 2022 22:42:30 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oiNxC-0004Fn-Ao for pgsql-committers@lists.postgresql.org; Tue, 11 Oct 2022 22:42:28 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id A534932004F8; Tue, 11 Oct 2022 18:42:23 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 11 Oct 2022 18:42:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm3; t=1665528143; x=1665614543; bh=ahxVOIkvGg yREdcXyZVgzLaurm6DO7ZOk+DCLlQw694=; b=AoU8b9tkQHBiWwC4CIGkp61+Fu dA8d4h11lRKNxZqYVa5/4z7L4zGjyNMPsA5RlzCHAUDysdygut1w72cVeFJg9d51 DmU9nPekGZJc7ceAMvc0PXWfOSlZLjKkWcvl7DhN3eO3niRoBOaIiemgDAaszb4d W1VtBVJUn3wppiw/RQcbI3O+aA6Itl+Yln1iOxZHKeXMND4yPf4xWYkg5r1G6Jaf +p5LnWazr2YUWWDI2KuLCqzZ/34fpGL0w1nZBKrO2mvNRebV+LrDZ4xv+iXGEIFx HxL7N0H/oEsp1/jfBHN8RlRW9WHkY6M3W5h0LRW4VeyV1oGoC5gaZfxPuxvg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1665528143; x=1665614543; bh=ahxVOIkvGgyREdcXyZVgzLaurm6D O7ZOk+DCLlQw694=; b=IQ0XxoE7sWv2F7s82om+mXZYzpyDjUd0V4FIp3J9jYmL se/0cLgBskYL1s3+l52BuUupYYc5U2Dd0ngM0dXSngZ/PiXiF2F8VTpFEsMEkzfu +mEKjkVb+VPUX3WZrUUJI5xRj+6ppQtnBqXMfWj7SXJ0hcvzOw4Zx5vnSfkXW31x DLkc3DNoIr7Qqhf12cD82ndBQC7iLelGE9VeO7dmP9bc599Mri7h2obuRKyTbBP6 ITcDz7ZrIt7hMppZ4Dwp7YI+vKg0KFZ5ExajVYBgeB/dw4MTeBbHhbB7KT5USDqJ 7B2cATK1ZCJRYCcE+P2XhnVJ0WA6NGBAYIkAiyja6Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeejjedgudegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomheptehnughr vghsucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrf grthhtvghrnhepvdfffeevhfetveffgeeiteefhfdtvdffjeevhfeuteegleduheetvedu ieettddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh eprghnughrvghssegrnhgrrhgriigvlhdruggv X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 11 Oct 2022 18:42:23 -0400 (EDT) Date: Tue, 11 Oct 2022 15:42:21 -0700 From: Andres Freund To: Michael Paquier Cc: pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Add support for COPY TO callback functions Message-ID: <20221011224221.dvg5q7e7vhjdtcvv@awork3.anarazel.de> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2022-10-11 02:47:56 +0000, Michael Paquier wrote: > Add support for COPY TO callback functions > > This is useful as a way for extensions to process COPY TO rows in the > way they see fit (say auditing, analytics, backend, etc.) without the > need to invoke an external process running as the OS user running the > backend through PROGRAM that requires superuser rights. COPY FROM > already provides a similar callback for logical replication. For COPY > TO, the callback is triggered when we are ready to send a row in > CopySendEndOfRow(), which is the same code path as when sending a row > to a frontend or a pipe/file. > > A small test module, test_copy_callbacks, is added to provide some > coverage for this facility. New warning with msvc 2022: C:\dev\postgres-meson\src\test\modules\test_copy_callbacks\test_copy_callbacks.c(40,73): warning C4047: 'function': 'bool' differs in levels of indirection from 'void *' [C:\dev\postgres-meson\build-msbuild-2022\src\test\modules\test_copy_callbacks\7d667bc@@test_copy_callbacks@sha.vcxproj] C:\dev\postgres-meson\src\test\modules\test_copy_callbacks\test_copy_callbacks.c(40,69): warning C4024: 'BeginCopyTo': different types for formal and actual parameter 6 [C:\dev\postgres-meson\build-msbuild-2022\src\test\modules\test_copy_callbacks\7d667bc@@test_copy_callbacks@sha.vcxproj] Looks quite justified. Passing NULL to bool is_program isn't right. Greetings, Andres Freund