1

I an working on PG logical replication by Java, and find a demo on the jdbc driver docs

PGReplicationStream stream =
        replConnection.getReplicationAPI()
            .replicationStream()
            .logical()
            .withSlotName("demo_logical_slot")
            .withSlotOption("include-xids", false)
            .withSlotOption("skip-empty-xacts", true)
            .start();

then I can parse message from the stream.

This is enough for some daily needs, but now I want to know the transaction commit time.

From the help of the question on stackoverflow, I add .withSlotOption("include-timestamp", "on") and it is working.

My question is where can find a complete list about the "slot option", so we can find them very conveniently instead of search on google or stackoverflow.

Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263
Bing
  • 29
  • 1
  • 6
  • 1
    A useful search phrase for your favorite search engine might be *postgresql slot option documentation* – Ken White Mar 06 '19 at 02:01
  • As far as I know those options depend on the decoding plugin that the slot uses. It's not an option for the replication slot –  Mar 06 '19 at 06:49

1 Answers1

4

The available options depend on the logical decoding plugin of the replication slot, which is specified when the replication slot is created.

The example must be using the test_decoding plugin, which is included with PostgreSQL as a contrib module for testing and playing.

The available options for that plugin are not documented, but can be found in the source code:

  • include-xids: include the transaction number in BEGIN and COMMIT output
  • include-timestamp: include timestamp information with COMMIT output
  • force-binary: specifies that the output mode is binary
  • skip-empty-xacts: don't output anything for transactions that didn't modify the database
  • only-local: output only data whose replication origin is not set
  • include-rewrites: include information from table rewrites caused by DDL statements
Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263