aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/trigger.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2017-05-09 23:34:02 -0400
committerRobert Haas <rhaas@postgresql.org>2017-05-09 23:34:02 -0400
commit9e6104c6672dc948a430d1ee269b0c31bf5bc974 (patch)
tree39c66a6e2787f7aef9b5edd36eac8a6389d1763d /src/backend/commands/trigger.c
parent29fd3d9da0ff9e230ff051c1423871bd6eac377d (diff)
downloadpostgresql-9e6104c6672dc948a430d1ee269b0c31bf5bc974.tar.gz
postgresql-9e6104c6672dc948a430d1ee269b0c31bf5bc974.zip
Prohibit transition tables on views and foreign tables.
Thomas Munro, per off-list report from Prabhat Sabu. Changes to the message wording for consistency with the existing relkind check for partitioned tables by me. Discussion: http://postgr.es/m/CAEepm=2xJFFpGM+N=gpWx-9Nft2q1oaFZX07_y23AHCrJQLt0g@mail.gmail.com
Diffstat (limited to 'src/backend/commands/trigger.c')
-rw-r--r--src/backend/commands/trigger.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c
index c0511639db0..819395a9678 100644
--- a/src/backend/commands/trigger.c
+++ b/src/backend/commands/trigger.c
@@ -361,6 +361,20 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString,
RelationGetRelationName(rel)),
errdetail("Triggers on partitioned tables cannot have transition tables.")));
+ if (rel->rd_rel->relkind == RELKIND_FOREIGN_TABLE)
+ ereport(ERROR,
+ (errcode(ERRCODE_WRONG_OBJECT_TYPE),
+ errmsg("\"%s\" is a foreign table",
+ RelationGetRelationName(rel)),
+ errdetail("Triggers on foreign tables cannot have transition tables.")));
+
+ if (rel->rd_rel->relkind == RELKIND_VIEW)
+ ereport(ERROR,
+ (errcode(ERRCODE_WRONG_OBJECT_TYPE),
+ errmsg("\"%s\" is a view",
+ RelationGetRelationName(rel)),
+ errdetail("Triggers on views cannot have transition tables.")));
+
if (stmt->timing != TRIGGER_TYPE_AFTER)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),