-
Notifications
You must be signed in to change notification settings - Fork 28
Description
Hi there. Thanks for putting this code out here, it's been super helpful in understanding how the logical replication works. But a couple problems/questions:
-
I found a problem with your example code. The last couple lines in the example look like this:
replication := pgoutput.LogicalReplication{
Subscription: "sub2",
Publication: "pub2",
WaitTimeout: time.Second * 10,
StatusTimeout: time.Second * 10,
Handler: handler,
}if err := replication.Start(ctx, conn); err != nil {
log.Fatal(err)
}I think it should be written this way instead:replication := pgoutput.NewSubscription("test_subscription", "test_provider")
if err := replication.Start(ctx, conn, handler); err != nil {
log.Fatal(err)
} -
The other thing is that when I make that fix and try to call Start, I get this:
2018/10/29 15:20:12 failed to start replication: ERROR: syntax error (SQLSTATE 42601)
I think that is because calling START REPLICATION on a slot with the pgoutput decoder type requires the pglogical extension to be present and for that publisher node to be created. It looks like pgoutput as a decoder is really only intended to be used if you're using the pglogical replication and not as a standalone decoder. I'm running on Postgres version 10.. maybe this works on an older version of postgres?
If I'm misunderstanding something I'd sure appreciate any clarification you could provide.
Thanks,
Greig Wise