0

I'm trying to utilze Postgres 10 logical replication mechanism by reading replication messages in Go code. Most of the logical replication messages refer to something called "Relation Id".

My question is: how to get Relation Ids for all of the existing tables? I am aware of "Relation" message type, but I don't know how to trigger them.

buoto
  • 405
  • 4
  • 13
  • 1
    Not 100% sure, but I assume that's the relation's [`oid`](https://www.postgresql.org/docs/current/static/catalog-pg-class.html) –  Mar 26 '18 at 09:58
  • Yes, it is. However I found out that I wanted to do it wrong way. I shouldn't load relations by myself. See: https://www.postgresql.org/docs/10/static/protocol-logical-replication.html#PROTOCOL-LOGICAL-MESSAGES-FLOW – buoto Mar 28 '18 at 14:04

1 Answers1

0

While using logical replication publisher sends Relation messages before sending the data, which contain all information necessary to decode incoming messages. Thus reading database schema beforehand would be not the right way of getting RelationID.

This was the documentation page I was missing.

buoto
  • 405
  • 4
  • 13