On 2018/12/06 13:19, Michael Paquier wrote:
> On Thu, Dec 06, 2018 at 11:34:19AM +0900, Amit Langote wrote:
>> Adding to January CF.
> 
> Okay, that looks good to me based on your arguments upthread.

Thanks for looking.

> A
> small-ish comment I have is that you could use a set of if/else if
> conditions instead of separate ifs.

Okay, no problem.  Updated patch attached.

Thanks,
Amit
diff --git a/src/backend/executor/execReplication.c 
b/src/backend/executor/execReplication.c
index 5bd3bbc35e..3ff741e684 100644
--- a/src/backend/executor/execReplication.c
+++ b/src/backend/executor/execReplication.c
@@ -608,6 +608,20 @@ void
 CheckSubscriptionRelkind(char relkind, const char *nspname,
                                                 const char *relname)
 {
+       /* Give more specific error for partitioned and foreign tables. */
+       if (relkind == RELKIND_PARTITIONED_TABLE)
+               ereport(ERROR,
+                               (errcode(ERRCODE_WRONG_OBJECT_TYPE),
+                                errmsg("\"%s.%s\" is a partitioned table",
+                                               nspname, relname),
+                                errdetail("Partitioned tables are not 
supported as logical replication targets.")));
+       else if (relkind == RELKIND_FOREIGN_TABLE)
+               ereport(ERROR,
+                               (errcode(ERRCODE_WRONG_OBJECT_TYPE),
+                                errmsg("\"%s.%s\" is a foreign table",
+                                               nspname, relname),
+                                errdetail("Foreign tables are not supported as 
logical replication targets.")));
+
        /*
         * We currently only support writing to regular tables.
         */

Reply via email to