Skip to content

Commit 09610ec

Browse files
hashmap-kzjackc
authored andcommitted
FIX-SEND-STANDBY-COPYDONE-PANIC - When receiving *pgproto3.DataRow, getting panic: "panic: runtime error: invalid memory address or nil pointer dereference". This patch will fix it.
1 parent 51ad596 commit 09610ec

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pglogrepl.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,12 +748,14 @@ type CopyDoneResult struct {
748748
// SendStandbyCopyDone sends a StandbyCopyDone to the PostgreSQL server
749749
// to confirm ending the copy-both mode.
750750
func SendStandbyCopyDone(_ context.Context, conn *pgconn.PgConn) (cdr *CopyDoneResult, err error) {
751+
cdr = &CopyDoneResult{}
752+
751753
// I am suspicious that this is wildly wrong, but I'm pretty sure the previous
752754
// code was wildly wrong too -- wttw <steve@blighty.com>
753755
conn.Frontend().Send(&pgproto3.CopyDone{})
754756
err = conn.Frontend().Flush()
755757
if err != nil {
756-
return
758+
return cdr, err
757759
}
758760

759761
for {

0 commit comments

Comments
 (0)