summaryrefslogtreecommitdiff
path: root/src/include/replication/logicalproto.h
diff options
context:
space:
mode:
authorAlvaro Herrera2018-03-15 00:34:26 +0000
committerAlvaro Herrera2018-03-15 00:34:26 +0000
commit24c0a6c649768f428929e76dd7f5012ec9b93ce1 (patch)
treec0b26eba9aaacb6169b3ecada3c19e5229c49d80 /src/include/replication/logicalproto.h
parent8df5a1c868cc28f89ac6221cff8e2b5c952d0eb6 (diff)
logical replication: fix OID type mapping mechanism
The logical replication type map seems to have been misused by its only caller -- it would try to use the remote OID as input for local type routines, which unsurprisingly could result in bogus "cache lookup failed for type XYZ" errors, or random other type names being picked up if they happened to use the right OID. Fix that, changing Oid logicalrep_typmap_getid(Oid remoteid) to char *logicalrep_typmap_gettypname(Oid remoteid) which is more useful. If the remote type is not part of the typmap, this simply prints "unrecognized type" instead of choking trying to figure out -- a pointless exercise (because the only input for that comes from replication messages, which are not under the local node's control) and dangerous to boot, when called from within an error context callback. Once that is done, it comes to light that the local OID in the typmap entry was not being used for anything; the type/schema names are what we need, so remove local type OID from that struct. Once you do that, it becomes pointless to attach a callback to regular syscache invalidation. So remove that also. Reported-by: Dang Minh Huong Author: Masahiko Sawada Reviewed-by: Álvaro Herrera, Petr Jelínek, Dang Minh Huong, Atsushi Torikoshi Discussion: https://postgr.es/m/[email protected] Discussion: https://postgr.es/m/[email protected]
Diffstat (limited to 'src/include/replication/logicalproto.h')
-rw-r--r--src/include/replication/logicalproto.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/include/replication/logicalproto.h b/src/include/replication/logicalproto.h
index 0eb21057c5b..116f16f42d1 100644
--- a/src/include/replication/logicalproto.h
+++ b/src/include/replication/logicalproto.h
@@ -55,10 +55,9 @@ typedef struct LogicalRepRelation
/* Type mapping info */
typedef struct LogicalRepTyp
{
- Oid remoteid; /* unique id of the type */
- char *nspname; /* schema name */
- char *typname; /* name of the type */
- Oid typoid; /* local type Oid */
+ Oid remoteid; /* unique id of the remote type */
+ char *nspname; /* schema name of remote type */
+ char *typname; /* name of the remote type */
} LogicalRepTyp;
/* Transaction info */