Re: Any objections to implementing LogicalDecodeMessageCB for pgoutput?

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: David Pirotte <dpirotte@gmail.com>
Cc: Dave Cramer <davecramer@gmail.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2020-09-08T19:18:23Z
Lists: pgsql-hackers
Hi,

On 2020-07-29 22:26:04 -0500, David Pirotte wrote:
> FWIW, we have been using pg_logical_emit_message to send application-level
> events alongside our change-data-capture for about two years, and we would
> move this part of our stack to pgoutput if message support was available.

Yea, it's really useful for this kind of thing.


> @@ -119,14 +124,16 @@ _PG_output_plugin_init(OutputPluginCallbacks *cb)
>  
>  static void
>  parse_output_parameters(List *options, uint32 *protocol_version,
> -						List **publication_names, bool *binary)
> +						List **publication_names, bool *binary, bool *messages)

I think it might be time to add a PgOutputParameters struct, instead of
adding more and more output parameters to
parse_output_parameters. Alternatively just passing PGOutputData owuld
make sense.


> diff --git a/src/test/subscription/t/015_messages.pl b/src/test/subscription/t/015_messages.pl
> new file mode 100644
> index 0000000000..4709e69f4e
> --- /dev/null
> +++ b/src/test/subscription/t/015_messages.pl

A test verifying that a non-transactional message in later aborted
transaction is handled correctly would be good.

Greetings,

Andres Freund



Commits

  1. Allow pgoutput to send logical decoding messages.

  2. Refactor function parse_output_parameters.