Re: pgsql: Add support for COPY TO callback functions

From: Andres Freund <andres(at)anarazel(dot)de>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Add support for COPY TO callback functions
Date: 2022-10-11 22:42:21
Message-ID: 20221011224221.dvg5q7e7vhjdtcvv@awork3.anarazel.de
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(at)sha(dot)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(at)sha(dot)vcxproj]

Looks quite justified. Passing NULL to bool is_program isn't right.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2022-10-11 22:54:50 pgsql: Harden pmsignal.c against clobbered shared memory.
Previous Message Tom Lane 2022-10-11 22:24:39 pgsql: Yet further fixes for multi-row VALUES lists for updatable views