修复DELETE目标表不是普通表时产生的core问题
This commit is contained in:
@ -225,6 +225,11 @@ int setTargetTable(ParseState* pstate, RangeVar* relRv, bool inh, bool alsoSourc
|
||||
(errcode(ERRCODE_DUPLICATE_ALIAS), errmsg("table name \"%s\" specified more than once",
|
||||
relRv->alias->aliasname)));
|
||||
} else if (relRv->alias == NULL && strcmp(rte1->eref->aliasname, relRv->relname) == 0) {
|
||||
if (rte1->rtekind != RTE_RELATION) {
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_OPERATE_NOT_SUPPORTED),
|
||||
errmsg("The target table \"%s\" of the DELETE is not updatable", relRv->relname)));
|
||||
}
|
||||
if (list_member_ptr(pstate->p_target_rangetblentry, rte1)) {
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_DUPLICATE_ALIAS), errmsg("table name \"%s\" specified more than once",
|
||||
|
||||
@ -1048,5 +1048,12 @@ select * from t_t_mutil_t2;
|
||||
drop view multiview1;
|
||||
drop view multiview2;
|
||||
drop view multiview3;
|
||||
-- issue
|
||||
WITH with_t1 AS ( SELECT TRUE AS c23 , -9213573085711696683 AS c49 ) DELETE with_t1 FROM with_t1;
|
||||
ERROR: The target table "with_t1" of the DELETE is not updatable
|
||||
DELETE subq_t1 FROM (SELECT 100 AS A) subq_t1;
|
||||
ERROR: The target table "subq_t1" of the DELETE is not updatable
|
||||
DELETE func_t1 FROM generate_series(1, 10) func_t1;
|
||||
ERROR: The target table "func_t1" of the DELETE is not updatable
|
||||
\c regression
|
||||
drop database multidelete;
|
||||
|
||||
@ -505,5 +505,11 @@ select * from t_t_mutil_t2;
|
||||
drop view multiview1;
|
||||
drop view multiview2;
|
||||
drop view multiview3;
|
||||
|
||||
-- issue
|
||||
WITH with_t1 AS ( SELECT TRUE AS c23 , -9213573085711696683 AS c49 ) DELETE with_t1 FROM with_t1;
|
||||
DELETE subq_t1 FROM (SELECT 100 AS A) subq_t1;
|
||||
DELETE func_t1 FROM generate_series(1, 10) func_t1;
|
||||
|
||||
\c regression
|
||||
drop database multidelete;
|
||||
|
||||
Reference in New Issue
Block a user