pglogrepl icon indicating copy to clipboard operation
pglogrepl copied to clipboard

Unable to use wal2json plugin with the demo

Open viggy28 opened this issue 1 year ago • 1 comments

I cannot get the demo running with wal2json as the output plugin. The message format looks completely different between wal2json and pgoutput. FWIW, I tried with both the format versions of wal2json and also tried it on different PG versions.

It panics since the pglogrepl.Message is Unknown

panic: interface conversion: interface is nil, not pglogrepl.Message 

goroutine 1 [running]:
github.com/jackc/pglogrepl.Parse({0xc0000f401e, 0xa8, 0xa8})
        /Users/viggy28/go/pkg/mod/github.com/jackc/[email protected]/message.go:649 +0x2b9
main.main()
        /Users/viggy28/Sourcecontrol/github.com/viggy28/pglogrepl/main.go:136 +0xdda

viggy28 avatar Apr 27 '23 00:04 viggy28

Hello @viggy28, I'm not sure if the question is still relevant for you. But in order to use pglogrepl with wal2json you should not use pglogrepl.Parse(xld.WALData). Instead, you should make a string from the xld.WALData (i.e. str := string(xld.WALData)) The string would contain actual output from the plugin in JSON format (e.g. {"action":"B"}, {"action":"C","origin":0}, etc.)

alikonhz avatar Jun 27 '23 13:06 alikonhz