PostgreSQL Source Code  git master
logicalrelation.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * logicalrelation.h
4  * Relation definitions for logical replication relation mapping.
5  *
6  * Portions Copyright (c) 2016-2020, PostgreSQL Global Development Group
7  *
8  * src/include/replication/logicalrelation.h
9  *
10  *-------------------------------------------------------------------------
11  */
12 #ifndef LOGICALRELATION_H
13 #define LOGICALRELATION_H
14 
15 #include "access/attmap.h"
17 
18 typedef struct LogicalRepRelMapEntry
19 {
20  LogicalRepRelation remoterel; /* key is remoterel.remoteid */
21 
22  /*
23  * Validity flag -- when false, revalidate all derived info at next
24  * logicalrep_rel_open. (While the localrel is open, we assume our lock
25  * on that rel ensures the info remains good.)
26  */
28 
29  /* Mapping to local relation. */
30  Oid localreloid; /* local relation id */
31  Relation localrel; /* relcache entry (NULL when closed) */
32  AttrMap *attrmap; /* map of local attributes to remote ones */
33  bool updatable; /* Can apply updates/deletes? */
34 
35  /* Sync state. */
36  char state;
39 
41 
43  LOCKMODE lockmode);
45  Relation partrel, AttrMap *map);
47  LOCKMODE lockmode);
48 
49 extern void logicalrep_typmap_update(LogicalRepTyp *remotetyp);
50 extern char *logicalrep_typmap_gettypname(Oid remoteid);
51 
52 #endif /* LOGICALRELATION_H */
int LOCKMODE
Definition: lockdefs.h:26
void logicalrep_typmap_update(LogicalRepTyp *remotetyp)
Definition: relation.c:469
unsigned int Oid
Definition: postgres_ext.h:31
void logicalrep_rel_close(LogicalRepRelMapEntry *rel, LOCKMODE lockmode)
Definition: relation.c:449
char * logicalrep_typmap_gettypname(Oid remoteid)
Definition: relation.c:503
Definition: attmap.h:34
LogicalRepRelation remoterel
LogicalRepRelMapEntry * logicalrep_partition_open(LogicalRepRelMapEntry *root, Relation partrel, AttrMap *map)
Definition: relation.c:632
LogicalRepRelMapEntry * logicalrep_rel_open(LogicalRepRelId remoteid, LOCKMODE lockmode)
Definition: relation.c:274
struct LogicalRepRelMapEntry LogicalRepRelMapEntry
uint64 XLogRecPtr
Definition: xlogdefs.h:21
void logicalrep_relmap_update(LogicalRepRelation *remoterel)
Definition: relation.c:173
uint32 LogicalRepRelId
Definition: logicalproto.h:57