From 04bead7c8a8d6a647336fa74c7a31cd3d36336bf Mon Sep 17 00:00:00 2001 From: Igor Novgorodov Date: Tue, 23 Oct 2018 10:50:34 +0200 Subject: [PATCH] Replication: add NOEXPORT_SNAPSHOT, add GetConnInfo() func --- replication.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/replication.go b/replication.go index 8e3a33bf..2efdcc79 100644 --- a/replication.go +++ b/replication.go @@ -11,6 +11,7 @@ import ( "github.com/jackc/pgx/pgio" "github.com/jackc/pgx/pgproto3" + "github.com/jackc/pgx/pgtype" ) const ( @@ -212,6 +213,10 @@ func (rc *ReplicationConn) CauseOfDeath() error { return rc.c.CauseOfDeath() } +func (rc *ReplicationConn) GetConnInfo() *pgtype.ConnInfo { + return rc.c.ConnInfo +} + func (rc *ReplicationConn) readReplicationMessage() (r *ReplicationMessage, err error) { msg, err := rc.c.rxMsg() if err != nil { @@ -436,7 +441,7 @@ func (rc *ReplicationConn) StartReplication(slotName string, startLsn uint64, ti // Create the replication slot, using the given name and output plugin. func (rc *ReplicationConn) CreateReplicationSlot(slotName, outputPlugin string) (err error) { - _, err = rc.c.Exec(fmt.Sprintf("CREATE_REPLICATION_SLOT %s LOGICAL %s", slotName, outputPlugin)) + _, err = rc.c.Exec(fmt.Sprintf("CREATE_REPLICATION_SLOT %s LOGICAL %s NOEXPORT_SNAPSHOT", slotName, outputPlugin)) return }