summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2017-04-26 12:05:04 -0400
committerPeter Eisentraut <peter_e@gmx.net>2017-04-26 12:07:22 -0400
commit61ecc90be624e699164a8d3efb291e267b711142 (patch)
tree33725ba9981938fc1903a790a791435d5cc36f94
parente495c1683f2c243f6769b34a009cf9c28526b555 (diff)
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 <euler@timbira.com.br>
-rw-r--r--src/backend/replication/logical/tablesync.c5
1 files 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'",