112 "LogicalRepRelMapContext",
141 if (remoterel->
natts > 0)
145 for (
i = 0;
i < remoterel->
natts;
i++)
193 for (
i = 0;
i < remoterel->
natts;
i++)
213 for (
i = 0;
i < remoterel->
natts;
i++)
261 errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
262 errmsg_plural(
"logical replication target relation \"%s.%s\" is missing replicated column: %s",
263 "logical replication target relation \"%s.%s\" is missing replicated columns: %s",
272 errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
273 errmsg_plural(
"logical replication target relation \"%s.%s\" has incompatible generated column: %s",
274 "logical replication target relation \"%s.%s\" has incompatible generated columns: %s",
316 if (idkey == NULL && remoterel->
replident != REPLICA_IDENTITY_FULL)
327 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
328 errmsg(
"logical replication target relation \"%s.%s\" uses "
329 "system columns in REPLICA IDENTITY index",
363 elog(
ERROR,
"no relation map entry for remote relation ID %u",
370 elog(
ERROR,
"remote relation ID %u is already open", remoteid);
420 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
421 errmsg(
"logical replication target relation \"%s.%s\" does not exist",
447 if (attr->attisdropped)
460 if (attr->attgenerated)
492 if (entry->
state != SUBREL_STATE_READY)
605 "LogicalRepPartMapContext",
609 ctl.keysize =
sizeof(
Oid);
696 for (
i = 0;
i < remoterel->
natts;
i++)
834 Anum_pg_index_indclass));
837 for (
int i = 0;
i < idxrel->
rd_index->indnkeyatts;
i++)
862 keycol = idxrel->
rd_index->indkey.values[0];
917 if (localrel->
rd_rel->relkind == RELKIND_PARTITIONED_TABLE)
927 if (remoterel->
replident == REPLICA_IDENTITY_FULL)
StrategyNumber IndexAmTranslateCompareType(CompareType cmptype, Oid amoid, Oid opfamily, bool missing_ok)
IndexAmRoutine * GetIndexAmRoutineByAmId(Oid amoid, bool noerror)
void free_attrmap(AttrMap *map)
AttrMap * make_attrmap(int maplen)
#define AttributeNumberIsValid(attributeNumber)
#define AttrNumberGetAttrOffset(attNum)
#define AttrNumberIsForUserDefinedAttr(attributeNumber)
Subscription * MySubscription
int bms_next_member(const Bitmapset *a, int prevbit)
Bitmapset * bms_add_range(Bitmapset *a, int lower, int upper)
Bitmapset * bms_del_member(Bitmapset *a, int x)
void bms_free(Bitmapset *a)
int bms_num_members(const Bitmapset *a)
bool bms_is_member(int x, const Bitmapset *a)
Bitmapset * bms_add_member(Bitmapset *a, int x)
Bitmapset * bms_copy(const Bitmapset *a)
#define OidIsValid(objectId)
void * hash_search(HTAB *hashp, const void *keyPtr, HASHACTION action, bool *foundPtr)
void * hash_seq_search(HASH_SEQ_STATUS *status)
void hash_seq_term(HASH_SEQ_STATUS *status)
HTAB * hash_create(const char *tabname, long nelem, const HASHCTL *info, int flags)
void hash_seq_init(HASH_SEQ_STATUS *status, HTAB *hashp)
int errmsg_plural(const char *fmt_singular, const char *fmt_plural, unsigned long n,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
void CheckSubscriptionRelkind(char relkind, const char *nspname, const char *relname)
Assert(PointerIsAligned(start, uint64))
bool heap_attisnull(HeapTuple tup, int attnum, TupleDesc tupleDesc)
void index_close(Relation relation, LOCKMODE lockmode)
Relation index_open(Oid relationId, LOCKMODE lockmode)
void CacheRegisterRelcacheCallback(RelcacheCallbackFunction func, Datum arg)
struct LogicalRepRelMapEntry LogicalRepRelMapEntry
Oid get_opclass_family(Oid opclass)
RangeVar * makeRangeVar(char *schemaname, char *relname, int location)
char * pstrdup(const char *in)
void pfree(void *pointer)
MemoryContext CacheMemoryContext
#define AllocSetContextCreate
#define ALLOCSET_DEFAULT_SIZES
#define RangeVarGetRelid(relation, lockmode, missing_ok)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
FormData_pg_attribute * Form_pg_attribute
#define foreach_oid(var, lst)
char GetSubscriptionRelState(Oid subid, Oid relid, XLogRecPtr *sublsn)
static Pointer DatumGetPointer(Datum X)
#define RelationGetRelid(relation)
#define RelationGetDescr(relation)
List * RelationGetIndexList(Relation relation)
Oid RelationGetPrimaryKeyIndex(Relation relation, bool deferrable_ok)
Bitmapset * RelationGetIndexAttrBitmap(Relation relation, IndexAttrBitmapKind attrKind)
Oid RelationGetReplicaIndex(Relation relation)
@ INDEX_ATTR_BITMAP_PRIMARY_KEY
@ INDEX_ATTR_BITMAP_IDENTITY_KEY
static MemoryContext LogicalRepPartMapContext
void logicalrep_partmap_reset_relmap(LogicalRepRelation *remoterel)
static void logicalrep_partmap_init(void)
static void logicalrep_report_missing_or_gen_attrs(LogicalRepRelation *remoterel, Bitmapset *missingatts, Bitmapset *generatedatts)
LogicalRepRelMapEntry * logicalrep_partition_open(LogicalRepRelMapEntry *root, Relation partrel, AttrMap *map)
static void logicalrep_relmap_free_entry(LogicalRepRelMapEntry *entry)
struct LogicalRepPartMapEntry LogicalRepPartMapEntry
static char * logicalrep_get_attrs_str(LogicalRepRelation *remoterel, Bitmapset *atts)
bool IsIndexUsableForReplicaIdentityFull(Relation idxrel, AttrMap *attrmap)
static void logicalrep_partmap_invalidate_cb(Datum arg, Oid reloid)
static HTAB * LogicalRepPartMap
static HTAB * LogicalRepRelMap
static void logicalrep_rel_mark_updatable(LogicalRepRelMapEntry *entry)
static MemoryContext LogicalRepRelMapContext
Oid GetRelationIdentityOrPK(Relation rel)
void logicalrep_relmap_update(LogicalRepRelation *remoterel)
static void logicalrep_relmap_init(void)
static int logicalrep_rel_att_by_name(LogicalRepRelation *remoterel, const char *attname)
static Oid FindUsableIndexForReplicaIdentityFull(Relation localrel, AttrMap *attrmap)
static void logicalrep_relmap_invalidate_cb(Datum arg, Oid reloid)
void logicalrep_rel_close(LogicalRepRelMapEntry *rel, LOCKMODE lockmode)
LogicalRepRelMapEntry * logicalrep_rel_open(LogicalRepRelId remoteid, LOCKMODE lockmode)
static Oid FindLogicalRepLocalIndex(Relation localrel, LogicalRepRelation *remoterel, AttrMap *attrMap)
void appendStringInfo(StringInfo str, const char *fmt,...)
void initStringInfo(StringInfo str)
amgettuple_function amgettuple
LogicalRepRelMapEntry relmapentry
LogicalRepRelation remoterel
struct HeapTupleData * rd_indextuple
Oid values[FLEXIBLE_ARRAY_MEMBER]
#define FirstLowInvalidHeapAttributeNumber
Datum SysCacheGetAttrNotNull(int cacheId, HeapTuple tup, AttrNumber attributeNumber)
Relation try_table_open(Oid relationId, LOCKMODE lockmode)
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)
static FormData_pg_attribute * TupleDescAttr(TupleDesc tupdesc, int i)
TypeCacheEntry * lookup_type_cache(Oid type_id, int flags)
#define TYPECACHE_EQ_OPR_FINFO