0

I'm exploring the module wal2json for the first time. I've set up the replication slot using the ReadMe examples.

When peeking the replication slot, every data value begins with an "action" property that appears to derive from a pretty short enum.

sample output of pg_logical_slot_peek_changes

From observation & docs, I've put together the following dictionary of actions letters → action labels.

letter label
M MESSAGE
B BEGIN
C COMMIT
U UPDATE
I INSERT
D DELETE

Obviously this is anecdotal & self-constructed. Is there any documentation or source code reference that fully enumerates and explains all possible values that could be present in this key?

1 Answer 1

1

Grepping through the source shows all the possible actions:

> grep '\\"action\\"' wal2json.c appendStringInfoString(ctx->out, "{\"action\":\"B\""); appendStringInfoString(ctx->out, "{\"action\":\"C\""); appendStringInfoString(ctx->out, "\"action\":\"I\""); appendStringInfoString(ctx->out, "\"action\":\"U\""); appendStringInfoString(ctx->out, "\"action\":\"D\""); appendStringInfoString(ctx->out, "\"action\":\"M\""); appendStringInfoString(ctx->out, "\"action\":\"T\""); 

The one action you were missing is T, and reading the code shows that it means TRUNCATE.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.