/*------------------------------------------------------------------------- * * logicalrelation.h * Relation definitions for logical replication relation mapping. * * Portions Copyright (c) 2016-2020, PostgreSQL Global Development Group * * src/include/replication/logicalrelation.h * *------------------------------------------------------------------------- */ #ifndef LOGICALRELATION_H #define LOGICALRELATION_H #include "access/attmap.h" #include "replication/logicalproto.h" typedef struct LogicalRepRelMapEntry { LogicalRepRelation remoterel; /* key is remoterel.remoteid */ /* Mapping to local relation. */ Oid localreloid; /* local relation id */ Relation localrel; /* relcache entry (NULL when closed) */ AttrMap *attrmap; /* map of local attributes to remote ones */ bool updatable; /* Can apply updates/deletes? */ /* Sync state. */ char state; /* Validity flag ... inserted here to avoid ABI break in back branches. */ bool localrelvalid; XLogRecPtr statelsn; } LogicalRepRelMapEntry; extern void logicalrep_relmap_update(LogicalRepRelation *remoterel); extern LogicalRepRelMapEntry *logicalrep_rel_open(LogicalRepRelId remoteid, LOCKMODE lockmode); extern LogicalRepRelMapEntry *logicalrep_partition_open(LogicalRepRelMapEntry *root, Relation partrel, AttrMap *map); extern void logicalrep_rel_close(LogicalRepRelMapEntry *rel, LOCKMODE lockmode); #endif /* LOGICALRELATION_H */