20 #ifdef USE_ASSERT_CHECKING
26 #include "catalog/pg_am_d.h"
113 "LogicalRepRelMapContext",
142 if (remoterel->
natts > 0)
146 for (
i = 0;
i < remoterel->
natts;
i++)
194 for (
i = 0;
i < remoterel->
natts;
i++)
214 for (
i = 0;
i < remoterel->
natts;
i++)
233 int missingattcnt = 0;
242 if (missingattcnt == 1)
251 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
252 errmsg_plural(
"logical replication target relation \"%s.%s\" is missing replicated column: %s",
253 "logical replication target relation \"%s.%s\" is missing replicated columns: %s",
257 missingattsbuf.
data)));
295 if (idkey == NULL && remoterel->
replident != REPLICA_IDENTITY_FULL)
306 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
307 errmsg(
"logical replication target relation \"%s.%s\" uses "
308 "system columns in REPLICA IDENTITY index",
342 elog(
ERROR,
"no relation map entry for remote relation ID %u",
349 elog(
ERROR,
"remote relation ID %u is already open", remoteid);
398 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
399 errmsg(
"logical replication target relation \"%s.%s\" does not exist",
425 if (attr->attisdropped || attr->attgenerated)
462 if (entry->
state != SUBREL_STATE_READY)
575 "LogicalRepPartMapContext",
667 for (
i = 0;
i < remoterel->
natts;
i++)
836 #ifdef USE_ASSERT_CHECKING
881 if (localrel->
rd_rel->relkind == RELKIND_PARTITIONED_TABLE)
891 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)
bool bms_is_member(int x, const Bitmapset *a)
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 OidIsValid(objectId)
elog(ERROR, "%s: %s", p2, msg)
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)
Assert(fmt[strlen(fmt) - 1] !='\n')
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)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
FormData_pg_attribute * Form_pg_attribute
char GetSubscriptionRelState(Oid subid, Oid relid, XLogRecPtr *sublsn)
#define RelationGetRelid(relation)
#define RelationGetDescr(relation)
List * RelationGetIndexList(Relation relation)
Oid RelationGetPrimaryKeyIndex(Relation relation)
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_attrs(LogicalRepRelation *remoterel, Bitmapset *missingatts)
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 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)