]> granicus.if.org Git - postgresql/commitdiff
Fix query that gets remote relation info
authorPeter Eisentraut <peter_e@gmx.net>
Wed, 26 Apr 2017 16:05:04 +0000 (12:05 -0400)
committerPeter Eisentraut <peter_e@gmx.net>
Wed, 26 Apr 2017 16:07:22 +0000 (12:07 -0400)
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>

src/backend/replication/logical/tablesync.c

index edd0adcb127478e121ee460f418590a4490daf6d..e63d26b0bcfd971e8d95267ea4710c19b91a4510 100644 (file)
@@ -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'",