copy stmt or alter stmt in action is not allowed

This commit is contained in:
wuyuechuan
2022-08-23 14:56:54 +08:00
parent a4bdb7450b
commit d63f47a3fc
3 changed files with 23 additions and 1 deletions

View File

@ -15090,7 +15090,15 @@ RuleStmt: CREATE opt_or_replace RULE name AS
RuleActionList:
NOTHING { $$ = NIL; }
| RuleActionStmt { $$ = list_make1($1); }
| RuleActionStmt {
#ifndef ENABLE_MULTIPLE_NODES
if (IsA($1, CopyStmt) || IsA($1, AlterTableStmt)) {
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("Unsupported feature"),
errdetail("copy stmt or alter stmt in action is not allowed")));
}
#endif
$$ = list_make1($1);
}
| '(' RuleActionMulti ')' { $$ = $2; }
;

View File

@ -347,4 +347,12 @@ select * from test_statement;
drop rule if exists r1 on escapetest;
drop table if exists test_statement;
drop table if exists escapetest;
-- unsupported rule
create table t1 (id int, name varchar(10));
create view v1 as select * from t1;
create rule r1 as on update to v1 do also alter table t1 modify name varchar(20);
ERROR: Unsupported feature
DETAIL: copy stmt or alter stmt in action is not allowed
drop table t1 cascade;
NOTICE: drop cascades to view v1
drop schema schema_rule_test cascade;

View File

@ -225,4 +225,10 @@ drop rule if exists r1 on escapetest;
drop table if exists test_statement;
drop table if exists escapetest;
-- unsupported rule
create table t1 (id int, name varchar(10));
create view v1 as select * from t1;
create rule r1 as on update to v1 do also alter table t1 modify name varchar(20);
drop table t1 cascade;
drop schema schema_rule_test cascade;