From: Peter Eisentraut Date: Wed, 26 Apr 2017 16:05:04 +0000 (-0400) Subject: Fix query that gets remote relation info X-Git-Tag: REL_10_BETA1~162 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=61ecc90be624e699164a8d3efb291e267b711142;p=thirdparty%2Fpostgresql.git 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 --- 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'",