Thanks for reviewing.

On 2018/12/31 20:23, Peter Eisentraut wrote:
> On 06/12/2018 05:46, Amit Langote wrote:
>>      /*
>>       * We currently only support writing to regular tables.
>>       */
> 
> I think that comment should stay above the code you are adding.

Do you mean to keep it at the top and expand it to mention the point about
partitioned and foreign tables, like this:

     /*
-     * We currently only support writing to regular tables.
+     * We currently only support writing to regular tables.  However, give
+     * a more specific error for partitioned and foreign tables.
      */
+    if (relkind == RELKIND_PARTITIONED_TABLE)

If so, that makes sense.  I've updated the patch like that.

Thanks,
Amit
diff --git a/src/backend/executor/execReplication.c 
b/src/backend/executor/execReplication.c
index e9c1beb1b7..3ed52084e5 100644
--- a/src/backend/executor/execReplication.c
+++ b/src/backend/executor/execReplication.c
@@ -609,8 +609,22 @@ CheckSubscriptionRelkind(char relkind, const char *nspname,
                                                 const char *relname)
 {
        /*
-        * We currently only support writing to regular tables.
+        * We currently only support writing to regular tables.  However, give
+        * a 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.")));
+
        if (relkind != RELKIND_RELATION)
                ereport(ERROR,
                                (errcode(ERRCODE_WRONG_OBJECT_TYPE),

Reply via email to