Skip to content

Start gives (SQLSTATE 42601) #4

@greigwise

Description

@greigwise

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:

  1. 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)
    }

  2. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions