aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2018-10-08 17:56:13 +0900
committerMichael Paquier <michael@paquier.xyz>2018-10-08 17:56:13 +0900
commit9c2a970d1fa4d30dc41d30d0b2ad557f40510549 (patch)
treee553789d38860cef36c04ef7a73dbbbeea042288 /src/backend/commands
parenta9da329be0bec586589cefc78da03ddb3fc13cbb (diff)
downloadpostgresql-9c2a970d1fa4d30dc41d30d0b2ad557f40510549.tar.gz
postgresql-9c2a970d1fa4d30dc41d30d0b2ad557f40510549.zip
Improve two error messages related to foreign keys on partitioned tables
Error messages for creating a foreign key on a partitioned table using ONLY or NOT VALID were wrong in mentioning the objects they worked on. This commit adds on the way some regression tests missing for those cases. Author: Laurenz Albe Reviewed-by: Michael Paquier Discussion: https://postgr.es/m/c11c05810a9ed65e9b2c817a9ef442275a32fe80.camel@cybertec.at
Diffstat (limited to 'src/backend/commands')
-rw-r--r--src/backend/commands/tablecmds.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 0a5eb68eb62..e10d3dbf3dd 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -7365,12 +7365,14 @@ ATAddForeignKeyConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel,
if (!recurse)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
- errmsg("foreign key referencing partitioned table \"%s\" must not be ONLY",
+ errmsg("cannot use ONLY for foreign key on partitioned table \"%s\" referencing relation \"%s\"",
+ RelationGetRelationName(rel),
RelationGetRelationName(pkrel))));
if (fkconstraint->skip_validation && !fkconstraint->initially_valid)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
- errmsg("cannot add NOT VALID foreign key to relation \"%s\"",
+ errmsg("cannot add NOT VALID foreign key on partitioned table \"%s\" referencing relation \"%s\"",
+ RelationGetRelationName(rel),
RelationGetRelationName(pkrel)),
errdetail("This feature is not yet supported on partitioned tables.")));
}