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-2024, 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"
16 #include "catalog/index.h"
18 
19 typedef struct LogicalRepRelMapEntry
20 {
21  LogicalRepRelation remoterel; /* key is remoterel.remoteid */
22 
23  /*
24  * Validity flag -- when false, revalidate all derived info at next
25  * logicalrep_rel_open. (While the localrel is open, we assume our lock
26  * on that rel ensures the info remains good.)
27  */
29 
30  /* Mapping to local relation. */
31  Oid localreloid; /* local relation id */
32  Relation localrel; /* relcache entry (NULL when closed) */
33  AttrMap *attrmap; /* map of local attributes to remote ones */
34  bool updatable; /* Can apply updates/deletes? */
35  Oid localindexoid; /* which index to use, or InvalidOid if none */
36 
37  /* Sync state. */
38  char state;
41 
42 extern void logicalrep_relmap_update(LogicalRepRelation *remoterel);
44 
46  LOCKMODE lockmode);
48  Relation partrel, AttrMap *map);
50  LOCKMODE lockmode);
51 extern bool IsIndexUsableForReplicaIdentityFull(IndexInfo *indexInfo, AttrMap *attrmap);
53 
54 #endif /* LOGICALRELATION_H */
int LOCKMODE
Definition: lockdefs.h:26
uint32 LogicalRepRelId
Definition: logicalproto.h:101
void logicalrep_partmap_reset_relmap(LogicalRepRelation *remoterel)
Definition: relation.c:540
bool IsIndexUsableForReplicaIdentityFull(IndexInfo *indexInfo, AttrMap *attrmap)
Definition: relation.c:804
LogicalRepRelMapEntry * logicalrep_partition_open(LogicalRepRelMapEntry *root, Relation partrel, AttrMap *map)
Definition: relation.c:602
struct LogicalRepRelMapEntry LogicalRepRelMapEntry
Oid GetRelationIdentityOrPK(Relation rel)
Definition: relation.c:851
void logicalrep_relmap_update(LogicalRepRelation *remoterel)
Definition: relation.c:164
LogicalRepRelMapEntry * logicalrep_rel_open(LogicalRepRelId remoteid, LOCKMODE lockmode)
Definition: relation.c:327
void logicalrep_rel_close(LogicalRepRelMapEntry *rel, LOCKMODE lockmode)
Definition: relation.c:473
unsigned int Oid
Definition: postgres_ext.h:31
tree ctl root
Definition: radixtree.h:1886
Definition: attmap.h:35
LogicalRepRelation remoterel
uint64 XLogRecPtr
Definition: xlogdefs.h:21