mirror of
https://github.com/postgres/postgres.git
synced 2026-02-21 00:40:20 -05:00
The existing code tried to do syscache lookups in an already-failed transaction, which is problematic to say the least. After some consideration of alternatives, the best fix seems to be to just drop type names from the error message altogether. The table and column names seem like sufficient localization. If the user is unsure what types are involved, she can check the local and remote table definitions. Having done that, we can also discard the LogicalRepTypMap hash table, which had no other use. Arguably, LOGICAL_REP_MSG_TYPE replication messages are now obsolete as well; but we should probably keep them in case some other use emerges. (The complexity of removing something from the replication protocol would likely outweigh any savings anyhow.) Masahiko Sawada and Bharath Rupireddy, per complaint from Andres Freund. Back-patch to v10 where this code originated. Discussion: https://postgr.es/m/20210106020229.ne5xnuu6wlondjpe@alap3.anarazel.de
49 lines
1.6 KiB
C
49 lines
1.6 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* logicalrelation.h
|
|
* Relation definitions for logical replication relation mapping.
|
|
*
|
|
* Portions Copyright (c) 2016-2021, PostgreSQL Global Development Group
|
|
*
|
|
* src/include/replication/logicalrelation.h
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
#ifndef LOGICALRELATION_H
|
|
#define LOGICALRELATION_H
|
|
|
|
#include "access/attmap.h"
|
|
#include "replication/logicalproto.h"
|
|
|
|
typedef struct LogicalRepRelMapEntry
|
|
{
|
|
LogicalRepRelation remoterel; /* key is remoterel.remoteid */
|
|
|
|
/*
|
|
* Validity flag -- when false, revalidate all derived info at next
|
|
* logicalrep_rel_open. (While the localrel is open, we assume our lock
|
|
* on that rel ensures the info remains good.)
|
|
*/
|
|
bool localrelvalid;
|
|
|
|
/* Mapping to local relation. */
|
|
Oid localreloid; /* local relation id */
|
|
Relation localrel; /* relcache entry (NULL when closed) */
|
|
AttrMap *attrmap; /* map of local attributes to remote ones */
|
|
bool updatable; /* Can apply updates/deletes? */
|
|
|
|
/* Sync state. */
|
|
char state;
|
|
XLogRecPtr statelsn;
|
|
} LogicalRepRelMapEntry;
|
|
|
|
extern void logicalrep_relmap_update(LogicalRepRelation *remoterel);
|
|
|
|
extern LogicalRepRelMapEntry *logicalrep_rel_open(LogicalRepRelId remoteid,
|
|
LOCKMODE lockmode);
|
|
extern LogicalRepRelMapEntry *logicalrep_partition_open(LogicalRepRelMapEntry *root,
|
|
Relation partrel, AttrMap *map);
|
|
extern void logicalrep_rel_close(LogicalRepRelMapEntry *rel,
|
|
LOCKMODE lockmode);
|
|
|
|
#endif /* LOGICALRELATION_H */
|