diff --git a/src/backend/executor/execReplication.c b/src/backend/executor/execReplication.c index 5bd3bbc35e..c95153b463 100644 --- a/src/backend/executor/execReplication.c +++ b/src/backend/executor/execReplication.c @@ -609,8 +609,24 @@ 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_FEATURE_NOT_SUPPORTED), + errmsg("cannot use \"%s.%s\" as logical replication target", + nspname, relname), + errdetail("\"%s.%s\" is a partitioned table.", + nspname, relname))); + else if (relkind == RELKIND_FOREIGN_TABLE) + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("cannot use \"%s.%s\" as logical replication target", + nspname, relname), + errdetail("\"%s.%s\" is a foreign table.", + nspname, relname))); + if (relkind != RELKIND_RELATION) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE),