From 61ecc90be624e699164a8d3efb291e267b711142 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 26 Apr 2017 12:05:04 -0400 Subject: [PATCH] Fix query that gets remote relation info Publisher relation can be incorrectly chosen, if there are more than one relation in different schemas with the same name. Author: Euler Taveira --- src/backend/replication/logical/tablesync.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/backend/replication/logical/tablesync.c b/src/backend/replication/logical/tablesync.c index edd0adcb127..e63d26b0bcf 100644 --- a/src/backend/replication/logical/tablesync.c +++ b/src/backend/replication/logical/tablesync.c @@ -560,8 +560,9 @@ fetch_remote_table_info(char *nspname, char *relname, /* First fetch Oid and replica identity. */ initStringInfo(&cmd); appendStringInfo(&cmd, "SELECT c.oid, c.relreplident" - " FROM pg_catalog.pg_class c," - " pg_catalog.pg_namespace n" + " FROM pg_catalog.pg_class c" + " INNER JOIN pg_catalog.pg_namespace n" + " ON (c.relnamespace = n.oid)" " WHERE n.nspname = %s" " AND c.relname = %s" " AND c.relkind = 'r'",