mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +03:00
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
This commit is contained in:
@ -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),
|
||||
|
Reference in New Issue
Block a user