I'm creating a logical replication slot with Java code using the PostgreSQL replication API and I want to add a test before the creation process to check if the slot exists already. this is my code :
connection.getReplicationAPI()
.createReplicationSlot()
.logical()
.withSlotName(slotName)
.withOutputPlugin("test_decoding")
.make();
SELECT
slot_name,
plugin,
slot_type,
datoid,
database,
temporary,
active,
active_pid,
xmin,
catalog_xmin,
restart_lsn,
confirmed_flush_lsn
FROM pg_replication_slots
WHERE slot_name = ?