PostgreSQL Source Code  git master
relation.c
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  * relation.c
3  * PostgreSQL logical replication relation mapping cache
4  *
5  * Copyright (c) 2016-2021, PostgreSQL Global Development Group
6  *
7  * IDENTIFICATION
8  * src/backend/replication/logical/relation.c
9  *
10  * NOTES
11  * Routines in this file mainly have to do with mapping the properties
12  * of local replication target relations to the properties of their
13  * remote counterpart.
14  *
15  *-------------------------------------------------------------------------
16  */
17 
18 #include "postgres.h"
19 
20 #include "access/table.h"
21 #include "catalog/namespace.h"
23 #include "executor/executor.h"
24 #include "nodes/makefuncs.h"
27 #include "utils/inval.h"
28 
29 
31 
32 static HTAB *LogicalRepRelMap = NULL;
33 
34 /*
35  * Partition map (LogicalRepPartMap)
36  *
37  * When a partitioned table is used as replication target, replicated
38  * operations are actually performed on its leaf partitions, which requires
39  * the partitions to also be mapped to the remote relation. Parent's entry
40  * (LogicalRepRelMapEntry) cannot be used as-is for all partitions, because
41  * individual partitions may have different attribute numbers, which means
42  * attribute mappings to remote relation's attributes must be maintained
43  * separately for each partition.
44  */
46 static HTAB *LogicalRepPartMap = NULL;
47 typedef struct LogicalRepPartMapEntry
48 {
49  Oid partoid; /* LogicalRepPartMap's key */
52 
53 /*
54  * Relcache invalidation callback for our relation map cache.
55  */
56 static void
58 {
59  LogicalRepRelMapEntry *entry;
60 
61  /* Just to be sure. */
62  if (LogicalRepRelMap == NULL)
63  return;
64 
65  if (reloid != InvalidOid)
66  {
68 
69  hash_seq_init(&status, LogicalRepRelMap);
70 
71  /* TODO, use inverse lookup hashtable? */
72  while ((entry = (LogicalRepRelMapEntry *) hash_seq_search(&status)) != NULL)
73  {
74  if (entry->localreloid == reloid)
75  {
76  entry->localrelvalid = false;
77  hash_seq_term(&status);
78  break;
79  }
80  }
81  }
82  else
83  {
84  /* invalidate all cache entries */
86 
87  hash_seq_init(&status, LogicalRepRelMap);
88 
89  while ((entry = (LogicalRepRelMapEntry *) hash_seq_search(&status)) != NULL)
90  entry->localrelvalid = false;
91  }
92 }
93 
94 /*
95  * Initialize the relation map cache.
96  */
97 static void
99 {
100  HASHCTL ctl;
101 
102  if (!LogicalRepRelMapContext)
103  LogicalRepRelMapContext =
105  "LogicalRepRelMapContext",
107 
108  /* Initialize the relation hash table. */
109  ctl.keysize = sizeof(LogicalRepRelId);
110  ctl.entrysize = sizeof(LogicalRepRelMapEntry);
112 
113  LogicalRepRelMap = hash_create("logicalrep relation map cache", 128, &ctl,
115 
116  /* Watch for invalidation events. */
118  (Datum) 0);
119 }
120 
121 /*
122  * Free the entry of a relation map cache.
123  */
124 static void
126 {
127  LogicalRepRelation *remoterel;
128 
129  remoterel = &entry->remoterel;
130 
131  pfree(remoterel->nspname);
132  pfree(remoterel->relname);
133 
134  if (remoterel->natts > 0)
135  {
136  int i;
137 
138  for (i = 0; i < remoterel->natts; i++)
139  pfree(remoterel->attnames[i]);
140 
141  pfree(remoterel->attnames);
142  pfree(remoterel->atttyps);
143  }
144  bms_free(remoterel->attkeys);
145 
146  if (entry->attrmap)
147  pfree(entry->attrmap);
148 }
149 
150 /*
151  * Add new entry or update existing entry in the relation map cache.
152  *
153  * Called when new relation mapping is sent by the publisher to update
154  * our expected view of incoming data from said publisher.
155  */
156 void
158 {
159  MemoryContext oldctx;
160  LogicalRepRelMapEntry *entry;
161  bool found;
162  int i;
163 
164  if (LogicalRepRelMap == NULL)
166 
167  /*
168  * HASH_ENTER returns the existing entry if present or creates a new one.
169  */
170  entry = hash_search(LogicalRepRelMap, (void *) &remoterel->remoteid,
171  HASH_ENTER, &found);
172 
173  if (found)
175 
176  memset(entry, 0, sizeof(LogicalRepRelMapEntry));
177 
178  /* Make cached copy of the data */
179  oldctx = MemoryContextSwitchTo(LogicalRepRelMapContext);
180  entry->remoterel.remoteid = remoterel->remoteid;
181  entry->remoterel.nspname = pstrdup(remoterel->nspname);
182  entry->remoterel.relname = pstrdup(remoterel->relname);
183  entry->remoterel.natts = remoterel->natts;
184  entry->remoterel.attnames = palloc(remoterel->natts * sizeof(char *));
185  entry->remoterel.atttyps = palloc(remoterel->natts * sizeof(Oid));
186  for (i = 0; i < remoterel->natts; i++)
187  {
188  entry->remoterel.attnames[i] = pstrdup(remoterel->attnames[i]);
189  entry->remoterel.atttyps[i] = remoterel->atttyps[i];
190  }
191  entry->remoterel.replident = remoterel->replident;
192  entry->remoterel.attkeys = bms_copy(remoterel->attkeys);
193  MemoryContextSwitchTo(oldctx);
194 }
195 
196 /*
197  * Find attribute index in TupleDesc struct by attribute name.
198  *
199  * Returns -1 if not found.
200  */
201 static int
203 {
204  int i;
205 
206  for (i = 0; i < remoterel->natts; i++)
207  {
208  if (strcmp(remoterel->attnames[i], attname) == 0)
209  return i;
210  }
211 
212  return -1;
213 }
214 
215 /*
216  * Report error with names of the missing local relation column(s), if any.
217  */
218 static void
220  Bitmapset *missingatts)
221 {
222  if (!bms_is_empty(missingatts))
223  {
224  StringInfoData missingattsbuf;
225  int missingattcnt = 0;
226  int i;
227 
228  initStringInfo(&missingattsbuf);
229 
230  while ((i = bms_first_member(missingatts)) >= 0)
231  {
232  missingattcnt++;
233  if (missingattcnt == 1)
234  appendStringInfo(&missingattsbuf, _("\"%s\""),
235  remoterel->attnames[i]);
236  else
237  appendStringInfo(&missingattsbuf, _(", \"%s\""),
238  remoterel->attnames[i]);
239  }
240 
241  ereport(ERROR,
242  (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
243  errmsg_plural("logical replication target relation \"%s.%s\" is missing replicated column: %s",
244  "logical replication target relation \"%s.%s\" is missing replicated columns: %s",
245  missingattcnt,
246  remoterel->nspname,
247  remoterel->relname,
248  missingattsbuf.data)));
249  }
250 }
251 
252 /*
253  * Open the local relation associated with the remote one.
254  *
255  * Rebuilds the Relcache mapping if it was invalidated by local DDL.
256  */
259 {
260  LogicalRepRelMapEntry *entry;
261  bool found;
262  LogicalRepRelation *remoterel;
263 
264  if (LogicalRepRelMap == NULL)
266 
267  /* Search for existing entry. */
268  entry = hash_search(LogicalRepRelMap, (void *) &remoteid,
269  HASH_FIND, &found);
270 
271  if (!found)
272  elog(ERROR, "no relation map entry for remote relation ID %u",
273  remoteid);
274 
275  remoterel = &entry->remoterel;
276 
277  /* Ensure we don't leak a relcache refcount. */
278  if (entry->localrel)
279  elog(ERROR, "remote relation ID %u is already open", remoteid);
280 
281  /*
282  * When opening and locking a relation, pending invalidation messages are
283  * processed which can invalidate the relation. Hence, if the entry is
284  * currently considered valid, try to open the local relation by OID and
285  * see if invalidation ensues.
286  */
287  if (entry->localrelvalid)
288  {
289  entry->localrel = try_table_open(entry->localreloid, lockmode);
290  if (!entry->localrel)
291  {
292  /* Table was renamed or dropped. */
293  entry->localrelvalid = false;
294  }
295  else if (!entry->localrelvalid)
296  {
297  /* Note we release the no-longer-useful lock here. */
298  table_close(entry->localrel, lockmode);
299  entry->localrel = NULL;
300  }
301  }
302 
303  /*
304  * If the entry has been marked invalid since we last had lock on it,
305  * re-open the local relation by name and rebuild all derived data.
306  */
307  if (!entry->localrelvalid)
308  {
309  Oid relid;
310  Bitmapset *idkey;
311  TupleDesc desc;
312  MemoryContext oldctx;
313  int i;
314  Bitmapset *missingatts;
315 
316  /* Try to find and lock the relation by name. */
317  relid = RangeVarGetRelid(makeRangeVar(remoterel->nspname,
318  remoterel->relname, -1),
319  lockmode, true);
320  if (!OidIsValid(relid))
321  ereport(ERROR,
322  (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
323  errmsg("logical replication target relation \"%s.%s\" does not exist",
324  remoterel->nspname, remoterel->relname)));
325  entry->localrel = table_open(relid, NoLock);
326  entry->localreloid = relid;
327 
328  /* Check for supported relkind. */
329  CheckSubscriptionRelkind(entry->localrel->rd_rel->relkind,
330  remoterel->nspname, remoterel->relname);
331 
332  /*
333  * Build the mapping of local attribute numbers to remote attribute
334  * numbers and validate that we don't miss any replicated columns as
335  * that would result in potentially unwanted data loss.
336  */
337  desc = RelationGetDescr(entry->localrel);
338  oldctx = MemoryContextSwitchTo(LogicalRepRelMapContext);
339  entry->attrmap = make_attrmap(desc->natts);
340  MemoryContextSwitchTo(oldctx);
341 
342  /* check and report missing attrs, if any */
343  missingatts = bms_add_range(NULL, 0, remoterel->natts - 1);
344  for (i = 0; i < desc->natts; i++)
345  {
346  int attnum;
347  Form_pg_attribute attr = TupleDescAttr(desc, i);
348 
349  if (attr->attisdropped || attr->attgenerated)
350  {
351  entry->attrmap->attnums[i] = -1;
352  continue;
353  }
354 
355  attnum = logicalrep_rel_att_by_name(remoterel,
356  NameStr(attr->attname));
357 
358  entry->attrmap->attnums[i] = attnum;
359  if (attnum >= 0)
360  missingatts = bms_del_member(missingatts, attnum);
361  }
362 
363  logicalrep_report_missing_attrs(remoterel, missingatts);
364 
365  /* be tidy */
366  bms_free(missingatts);
367 
368  /*
369  * Check that replica identity matches. We allow for stricter replica
370  * identity (fewer columns) on subscriber as that will not stop us
371  * from finding unique tuple. IE, if publisher has identity
372  * (id,timestamp) and subscriber just (id) this will not be a problem,
373  * but in the opposite scenario it will.
374  *
375  * Don't throw any error here just mark the relation entry as not
376  * updatable, as replica identity is only for updates and deletes but
377  * inserts can be replicated even without it.
378  */
379  entry->updatable = true;
380  idkey = RelationGetIndexAttrBitmap(entry->localrel,
382  /* fallback to PK if no replica identity */
383  if (idkey == NULL)
384  {
385  idkey = RelationGetIndexAttrBitmap(entry->localrel,
387 
388  /*
389  * If no replica identity index and no PK, the published table
390  * must have replica identity FULL.
391  */
392  if (idkey == NULL && remoterel->replident != REPLICA_IDENTITY_FULL)
393  entry->updatable = false;
394  }
395 
396  i = -1;
397  while ((i = bms_next_member(idkey, i)) >= 0)
398  {
400 
401  if (!AttrNumberIsForUserDefinedAttr(attnum))
402  ereport(ERROR,
403  (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
404  errmsg("logical replication target relation \"%s.%s\" uses "
405  "system columns in REPLICA IDENTITY index",
406  remoterel->nspname, remoterel->relname)));
407 
408  attnum = AttrNumberGetAttrOffset(attnum);
409 
410  if (entry->attrmap->attnums[attnum] < 0 ||
411  !bms_is_member(entry->attrmap->attnums[attnum], remoterel->attkeys))
412  {
413  entry->updatable = false;
414  break;
415  }
416  }
417 
418  entry->localrelvalid = true;
419  }
420 
421  if (entry->state != SUBREL_STATE_READY)
423  entry->localreloid,
424  &entry->statelsn);
425 
426  return entry;
427 }
428 
429 /*
430  * Close the previously opened logical relation.
431  */
432 void
434 {
435  table_close(rel->localrel, lockmode);
436  rel->localrel = NULL;
437 }
438 
439 /*
440  * Partition cache: look up partition LogicalRepRelMapEntry's
441  *
442  * Unlike relation map cache, this is keyed by partition OID, not remote
443  * relation OID, because we only have to use this cache in the case where
444  * partitions are not directly mapped to any remote relation, such as when
445  * replication is occurring with one of their ancestors as target.
446  */
447 
448 /*
449  * Relcache invalidation callback
450  */
451 static void
453 {
454  LogicalRepRelMapEntry *entry;
455 
456  /* Just to be sure. */
457  if (LogicalRepPartMap == NULL)
458  return;
459 
460  if (reloid != InvalidOid)
461  {
463 
464  hash_seq_init(&status, LogicalRepPartMap);
465 
466  /* TODO, use inverse lookup hashtable? */
467  while ((entry = (LogicalRepRelMapEntry *) hash_seq_search(&status)) != NULL)
468  {
469  if (entry->localreloid == reloid)
470  {
471  entry->localrelvalid = false;
472  hash_seq_term(&status);
473  break;
474  }
475  }
476  }
477  else
478  {
479  /* invalidate all cache entries */
481 
482  hash_seq_init(&status, LogicalRepPartMap);
483 
484  while ((entry = (LogicalRepRelMapEntry *) hash_seq_search(&status)) != NULL)
485  entry->localrelvalid = false;
486  }
487 }
488 
489 /*
490  * Initialize the partition map cache.
491  */
492 static void
494 {
495  HASHCTL ctl;
496 
497  if (!LogicalRepPartMapContext)
498  LogicalRepPartMapContext =
500  "LogicalRepPartMapContext",
502 
503  /* Initialize the relation hash table. */
504  ctl.keysize = sizeof(Oid); /* partition OID */
505  ctl.entrysize = sizeof(LogicalRepPartMapEntry);
507 
508  LogicalRepPartMap = hash_create("logicalrep partition map cache", 64, &ctl,
510 
511  /* Watch for invalidation events. */
513  (Datum) 0);
514 }
515 
516 /*
517  * logicalrep_partition_open
518  *
519  * Returned entry reuses most of the values of the root table's entry, save
520  * the attribute map, which can be different for the partition. However,
521  * we must physically copy all the data, in case the root table's entry
522  * gets freed/rebuilt.
523  *
524  * Note there's no logicalrep_partition_close, because the caller closes the
525  * component relation.
526  */
529  Relation partrel, AttrMap *map)
530 {
531  LogicalRepRelMapEntry *entry;
532  LogicalRepPartMapEntry *part_entry;
533  LogicalRepRelation *remoterel = &root->remoterel;
534  Oid partOid = RelationGetRelid(partrel);
535  AttrMap *attrmap = root->attrmap;
536  bool found;
537  int i;
538  MemoryContext oldctx;
539 
540  if (LogicalRepPartMap == NULL)
542 
543  /* Search for existing entry. */
544  part_entry = (LogicalRepPartMapEntry *) hash_search(LogicalRepPartMap,
545  (void *) &partOid,
546  HASH_ENTER, &found);
547 
548  if (found)
549  return &part_entry->relmapentry;
550 
551  memset(part_entry, 0, sizeof(LogicalRepPartMapEntry));
552 
553  /* Switch to longer-lived context. */
554  oldctx = MemoryContextSwitchTo(LogicalRepPartMapContext);
555 
556  part_entry->partoid = partOid;
557 
558  /* Remote relation is copied as-is from the root entry. */
559  entry = &part_entry->relmapentry;
560  entry->remoterel.remoteid = remoterel->remoteid;
561  entry->remoterel.nspname = pstrdup(remoterel->nspname);
562  entry->remoterel.relname = pstrdup(remoterel->relname);
563  entry->remoterel.natts = remoterel->natts;
564  entry->remoterel.attnames = palloc(remoterel->natts * sizeof(char *));
565  entry->remoterel.atttyps = palloc(remoterel->natts * sizeof(Oid));
566  for (i = 0; i < remoterel->natts; i++)
567  {
568  entry->remoterel.attnames[i] = pstrdup(remoterel->attnames[i]);
569  entry->remoterel.atttyps[i] = remoterel->atttyps[i];
570  }
571  entry->remoterel.replident = remoterel->replident;
572  entry->remoterel.attkeys = bms_copy(remoterel->attkeys);
573 
574  entry->localrel = partrel;
575  entry->localreloid = partOid;
576 
577  /*
578  * If the partition's attributes don't match the root relation's, we'll
579  * need to make a new attrmap which maps partition attribute numbers to
580  * remoterel's, instead of the original which maps root relation's
581  * attribute numbers to remoterel's.
582  *
583  * Note that 'map' which comes from the tuple routing data structure
584  * contains 1-based attribute numbers (of the parent relation). However,
585  * the map in 'entry', a logical replication data structure, contains
586  * 0-based attribute numbers (of the remote relation).
587  */
588  if (map)
589  {
590  AttrNumber attno;
591 
592  entry->attrmap = make_attrmap(map->maplen);
593  for (attno = 0; attno < entry->attrmap->maplen; attno++)
594  {
595  AttrNumber root_attno = map->attnums[attno];
596 
597  entry->attrmap->attnums[attno] = attrmap->attnums[root_attno - 1];
598  }
599  }
600  else
601  {
602  /* Lacking copy_attmap, do this the hard way. */
603  entry->attrmap = make_attrmap(attrmap->maplen);
604  memcpy(entry->attrmap->attnums, attrmap->attnums,
605  attrmap->maplen * sizeof(AttrNumber));
606  }
607 
608  entry->updatable = root->updatable;
609 
610  entry->localrelvalid = true;
611 
612  /* state and statelsn are left set to 0. */
613  MemoryContextSwitchTo(oldctx);
614 
615  return entry;
616 }
Subscription * MySubscription
Definition: worker.c:247
static void logicalrep_relmap_free_entry(LogicalRepRelMapEntry *entry)
Definition: relation.c:125
static void logicalrep_partmap_init(void)
Definition: relation.c:493
int bms_first_member(Bitmapset *a)
Definition: bitmapset.c:996
#define AllocSetContextCreate
Definition: memutils.h:173
void table_close(Relation relation, LOCKMODE lockmode)
Definition: table.c:167
Bitmapset * bms_copy(const Bitmapset *a)
Definition: bitmapset.c:74
#define HASH_CONTEXT
Definition: hsearch.h:102
#define HASH_ELEM
Definition: hsearch.h:95
MemoryContext hcxt
Definition: hsearch.h:86
#define RelationGetDescr(relation)
Definition: rel.h:503
int LOCKMODE
Definition: lockdefs.h:26
int errmsg_plural(const char *fmt_singular, const char *fmt_plural, unsigned long n,...)
Definition: elog.c:1019
#define RangeVarGetRelid(relation, lockmode, missing_ok)
Definition: namespace.h:79
#define TupleDescAttr(tupdesc, i)
Definition: tupdesc.h:92
char * pstrdup(const char *in)
Definition: mcxt.c:1299
int bms_next_member(const Bitmapset *a, int prevbit)
Definition: bitmapset.c:1043
struct LogicalRepPartMapEntry LogicalRepPartMapEntry
int maplen
Definition: attmap.h:37
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
Definition: palloc.h:109
Size entrysize
Definition: hsearch.h:76
#define AttrNumberIsForUserDefinedAttr(attributeNumber)
Definition: attnum.h:41
int errcode(int sqlerrcode)
Definition: elog.c:698
void logicalrep_rel_close(LogicalRepRelMapEntry *rel, LOCKMODE lockmode)
Definition: relation.c:433
#define FirstLowInvalidHeapAttributeNumber
Definition: sysattr.h:27
void * hash_search(HTAB *hashp, const void *keyPtr, HASHACTION action, bool *foundPtr)
Definition: dynahash.c:954
Form_pg_class rd_rel
Definition: rel.h:109
unsigned int Oid
Definition: postgres_ext.h:31
Relation try_table_open(Oid relationId, LOCKMODE lockmode)
Definition: table.c:69
#define OidIsValid(objectId)
Definition: c.h:710
Bitmapset * attkeys
Definition: logicalproto.h:109
Definition: attmap.h:34
LogicalRepRelId remoteid
Definition: logicalproto.h:101
void CacheRegisterRelcacheCallback(RelcacheCallbackFunction func, Datum arg)
Definition: inval.c:1540
static void logicalrep_report_missing_attrs(LogicalRepRelation *remoterel, Bitmapset *missingatts)
Definition: relation.c:219
void logicalrep_relmap_update(LogicalRepRelation *remoterel)
Definition: relation.c:157
Definition: dynahash.c:219
void pfree(void *pointer)
Definition: mcxt.c:1169
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition: stringinfo.c:91
Bitmapset * bms_add_range(Bitmapset *a, int lower, int upper)
Definition: bitmapset.c:834
#define ERROR
Definition: elog.h:46
NameData attname
Definition: pg_attribute.h:41
static int logicalrep_rel_att_by_name(LogicalRepRelation *remoterel, const char *attname)
Definition: relation.c:202
LogicalRepRelation remoterel
static HTAB * LogicalRepPartMap
Definition: relation.c:46
static void logicalrep_relmap_invalidate_cb(Datum arg, Oid reloid)
Definition: relation.c:57
LogicalRepRelMapEntry relmapentry
Definition: relation.c:50
#define ALLOCSET_DEFAULT_SIZES
Definition: memutils.h:195
#define AttrNumberGetAttrOffset(attNum)
Definition: attnum.h:51
#define NoLock
Definition: lockdefs.h:34
static MemoryContext LogicalRepRelMapContext
Definition: relation.c:30
HTAB * hash_create(const char *tabname, long nelem, const HASHCTL *info, int flags)
Definition: dynahash.c:349
FormData_pg_attribute * Form_pg_attribute
Definition: pg_attribute.h:207
void CheckSubscriptionRelkind(char relkind, const char *nspname, const char *relname)
LogicalRepRelMapEntry * logicalrep_rel_open(LogicalRepRelId remoteid, LOCKMODE lockmode)
Definition: relation.c:258
bool bms_is_empty(const Bitmapset *a)
Definition: bitmapset.c:701
void initStringInfo(StringInfo str)
Definition: stringinfo.c:59
#define HASH_BLOBS
Definition: hsearch.h:97
struct LogicalRepRelMapEntry LogicalRepRelMapEntry
char GetSubscriptionRelState(Oid subid, Oid relid, XLogRecPtr *sublsn)
uintptr_t Datum
Definition: postgres.h:411
Size keysize
Definition: hsearch.h:75
#define InvalidOid
Definition: postgres_ext.h:36
LogicalRepRelMapEntry * logicalrep_partition_open(LogicalRepRelMapEntry *root, Relation partrel, AttrMap *map)
Definition: relation.c:528
int16 attnum
Definition: pg_attribute.h:83
#define ereport(elevel,...)
Definition: elog.h:157
void bms_free(Bitmapset *a)
Definition: bitmapset.c:208
static void logicalrep_partmap_invalidate_cb(Datum arg, Oid reloid)
Definition: relation.c:452
AttrNumber * attnums
Definition: attmap.h:36
void * hash_seq_search(HASH_SEQ_STATUS *status)
Definition: dynahash.c:1436
void hash_seq_init(HASH_SEQ_STATUS *status, HTAB *hashp)
Definition: dynahash.c:1426
AttrMap * make_attrmap(int maplen)
Definition: attmap.c:41
static MemoryContext LogicalRepPartMapContext
Definition: relation.c:45
void * palloc(Size size)
Definition: mcxt.c:1062
int errmsg(const char *fmt,...)
Definition: elog.c:909
#define elog(elevel,...)
Definition: elog.h:232
int i
Bitmapset * RelationGetIndexAttrBitmap(Relation relation, IndexAttrBitmapKind attrKind)
Definition: relcache.c:5003
#define NameStr(name)
Definition: c.h:681
void * arg
static void logicalrep_relmap_init(void)
Definition: relation.c:98
static void static void status(const char *fmt,...) pg_attribute_printf(1
Definition: pg_regress.c:227
Relation table_open(Oid relationId, LOCKMODE lockmode)
Definition: table.c:39
Bitmapset * bms_del_member(Bitmapset *a, int x)
Definition: bitmapset.c:773
bool bms_is_member(int x, const Bitmapset *a)
Definition: bitmapset.c:427
int16 AttrNumber
Definition: attnum.h:21
#define _(x)
Definition: elog.c:89
#define RelationGetRelid(relation)
Definition: rel.h:477
RangeVar * makeRangeVar(char *schemaname, char *relname, int location)
Definition: makefuncs.c:422
void hash_seq_term(HASH_SEQ_STATUS *status)
Definition: dynahash.c:1512
static HTAB * LogicalRepRelMap
Definition: relation.c:32
uint32 LogicalRepRelId
Definition: logicalproto.h:95
MemoryContext CacheMemoryContext
Definition: mcxt.c:51