mirror of https://github.com/jackc/pgx.git
Add the drop replication slot functionality
parent
c88c110169
commit
af01afca00
|
@ -362,7 +362,7 @@ func (rc *ReplicationConn) CreateReplicationSlot(slotName, outputPlugin string)
|
|||
}
|
||||
|
||||
// Drop the replication slot for the given name
|
||||
func (rc *ReplicationConn) DropReplicationSlot(slotName, outputPlugin string) (err error) {
|
||||
func (rc *ReplicationConn) DropReplicationSlot(slotName string) (err error) {
|
||||
_, err = rc.c.Exec(fmt.Sprintf("DROP_REPLICATION_SLOT %s", slotName))
|
||||
return
|
||||
}
|
||||
|
|
|
@ -173,6 +173,10 @@ func TestSimpleReplicationConnection(t *testing.T) {
|
|||
t.Errorf("Unexpected write position %d", status.WalWritePosition)
|
||||
}
|
||||
|
||||
err = replicationConn.DropReplicationSlot("pgx_test")
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to drop replication slot %v", err)
|
||||
}
|
||||
err = replicationConn.Close()
|
||||
if err != nil {
|
||||
t.Fatalf("Replication connection close failed: %v", err)
|
||||
|
@ -183,10 +187,4 @@ func TestSimpleReplicationConnection(t *testing.T) {
|
|||
if integerRestartLsn != maxWal {
|
||||
t.Fatalf("Wal offset update failed, expected %s found %s", pgx.FormatLSN(maxWal), restartLsn)
|
||||
}
|
||||
|
||||
_, err = conn.Exec("select pg_drop_replication_slot($1)", "pgx_test")
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to drop replication slot: %v", err)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue