Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit373bda6

Browse files
committed
Improve error messages for incorrect types of logical replication targets
If trying to use something else than a plain table as logicalreplication target, a rather-generic error message gets used to reportthe problem. This can be confusing when it comes to foreign tables andpartitioned tables, so use more dedicated messages in these cases.Author: Amit LangoteReviewed-by: Peter Eisentraut, Magnus Hagander, Michael PaquierDiscussion:https://postgr.es/m/41799bee-40eb-7bb5-80b1-325ce17518bc@lab.ntt.co.jp
1 parent1845ca2 commit373bda6

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

‎src/backend/executor/execReplication.c

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,11 +609,29 @@ CheckSubscriptionRelkind(char relkind, const char *nspname,
609609
constchar*relname)
610610
{
611611
/*
612-
* We currently only support writing to regular tables.
612+
* We currently only support writing to regular tables. However, give
613+
* a more specific error for partitioned and foreign tables.
613614
*/
615+
if (relkind==RELKIND_PARTITIONED_TABLE)
616+
ereport(ERROR,
617+
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
618+
errmsg("cannot use relation \"%s.%s\" as logical replication target",
619+
nspname,relname),
620+
errdetail("\"%s.%s\" is a partitioned table.",
621+
nspname,relname)));
622+
elseif (relkind==RELKIND_FOREIGN_TABLE)
623+
ereport(ERROR,
624+
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
625+
errmsg("cannot use relation \"%s.%s\" as logical replication",
626+
nspname,relname),
627+
errdetail("\"%s.%s\" is a foreign table.",
628+
nspname,relname)));
629+
614630
if (relkind!=RELKIND_RELATION)
615631
ereport(ERROR,
616632
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
617-
errmsg("logical replication target relation \"%s.%s\" is not a table",
633+
errmsg("cannot use relation \"%s.%s\" as logical replication target",
634+
nspname,relname),
635+
errdetail("\"%s.%s\" is not a table.",
618636
nspname,relname)));
619637
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp