20 #ifdef USE_ASSERT_CHECKING
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++)
863 #ifdef USE_ASSERT_CHECKING
908 if (localrel->
rd_rel->relkind == RELKIND_PARTITIONED_TABLE)
918 if (remoterel->
replident == REPLICA_IDENTITY_FULL)
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)
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_del_member(Bitmapset *a, int x)
Bitmapset * bms_copy(const Bitmapset *a)
Bitmapset * bms_add_range(Bitmapset *a, int lower, int upper)
#define Assert(condition)
#define OidIsValid(objectId)
void * hash_search(HTAB *hashp, const void *keyPtr, HASHACTION action, bool *foundPtr)
void hash_seq_term(HASH_SEQ_STATUS *status)
HTAB * hash_create(const char *tabname, long nelem, const HASHCTL *info, int flags)
void * hash_seq_search(HASH_SEQ_STATUS *status)
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)
StrategyNumber get_equal_strategy_number_for_am(Oid am)
IndexInfo * BuildIndexInfo(Relation index)
void index_close(Relation relation, LOCKMODE lockmode)
Relation index_open(Oid relationId, LOCKMODE lockmode)
void CacheRegisterRelcacheCallback(RelcacheCallbackFunction func, Datum arg)
struct LogicalRepRelMapEntry LogicalRepRelMapEntry
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)
FormData_pg_attribute * Form_pg_attribute
#define foreach_oid(var, lst)
char GetSubscriptionRelState(Oid subid, Oid relid, XLogRecPtr *sublsn)
MemoryContextSwitchTo(old_ctx)
#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)
bool IsIndexUsableForReplicaIdentityFull(IndexInfo *indexInfo, AttrMap *attrmap)
static void logicalrep_relmap_free_entry(LogicalRepRelMapEntry *entry)
LogicalRepRelMapEntry * logicalrep_partition_open(LogicalRepRelMapEntry *root, Relation partrel, AttrMap *map)
struct LogicalRepPartMapEntry LogicalRepPartMapEntry
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 char * logicalrep_get_attrs_str(LogicalRepRelation *remoterel, Bitmapset *atts)
static MemoryContext LogicalRepRelMapContext
Oid GetRelationIdentityOrPK(Relation rel)
void logicalrep_relmap_update(LogicalRepRelation *remoterel)
static void logicalrep_relmap_init(void)
LogicalRepRelMapEntry * logicalrep_rel_open(LogicalRepRelId remoteid, LOCKMODE lockmode)
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)
static Oid FindLogicalRepLocalIndex(Relation localrel, LogicalRepRelation *remoterel, AttrMap *attrMap)
void appendStringInfo(StringInfo str, const char *fmt,...)
void initStringInfo(StringInfo str)
amgettuple_function amgettuple
AttrNumber ii_IndexAttrNumbers[INDEX_MAX_KEYS]
LogicalRepRelMapEntry relmapentry
LogicalRepRelation remoterel
#define FirstLowInvalidHeapAttributeNumber
Relation try_table_open(Oid relationId, LOCKMODE lockmode)
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)
#define TupleDescAttr(tupdesc, i)