修复pullup导致的core问题
This commit is contained in:
@ -6436,7 +6436,6 @@ void convert_ORCLAUSE_to_join(PlannerInfo *root, BoolExpr *or_clause, Node **jtl
|
||||
/* fall through */
|
||||
case T_OpExpr:
|
||||
{
|
||||
Node *notNullAnd = NULL;
|
||||
bool replace = false;
|
||||
ListCell *cell = NULL;
|
||||
|
||||
@ -6454,16 +6453,10 @@ void convert_ORCLAUSE_to_join(PlannerInfo *root, BoolExpr *or_clause, Node **jtl
|
||||
jtlink1, available_rels1, replace, isnull);
|
||||
|
||||
if (notNullExpr != NULL) {
|
||||
notNullAnd = make_and_qual(notNullAnd, notNullExpr);
|
||||
replace = true;
|
||||
}
|
||||
}
|
||||
|
||||
/* This opexpr's sublink always be pulled up, and it will be replaced with not null expr.*/
|
||||
|
||||
if (notNullAnd != NULL) {
|
||||
or_clause = (BoolExpr*)replace_node_clause((Node*)or_clause, clause, notNullAnd, RNC_RECURSE_AGGREF);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@ -883,3 +883,30 @@ order by
|
||||
-> Seq Scan on supplier
|
||||
(38 rows)
|
||||
|
||||
create table t1(c1 int,c2 int);
|
||||
create table t2(c1 int,c2 int);
|
||||
create table t3(c1 int,c2 int);
|
||||
insert into t1 values(1,1),(2,2),(3,3);
|
||||
insert into t2 values(1,1),(2,2),(3,3);
|
||||
insert into t3 values(1,1),(2,2),(3,3);
|
||||
select count(0)
|
||||
from
|
||||
(
|
||||
select t1.* from t1
|
||||
where ((
|
||||
(select count(1)
|
||||
from t2
|
||||
where t2.c1=t1.c1) +
|
||||
(select count(1)
|
||||
from t3
|
||||
where t3.c1=t1.c1)) > 0
|
||||
or t1.c1 = 5)
|
||||
) tmp_count;
|
||||
count
|
||||
-------
|
||||
3
|
||||
(1 row)
|
||||
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
|
||||
@ -343,3 +343,29 @@ order by
|
||||
n_name,
|
||||
s_name,
|
||||
p_partkey;
|
||||
|
||||
|
||||
create table t1(c1 int,c2 int);
|
||||
create table t2(c1 int,c2 int);
|
||||
create table t3(c1 int,c2 int);
|
||||
insert into t1 values(1,1),(2,2),(3,3);
|
||||
insert into t2 values(1,1),(2,2),(3,3);
|
||||
insert into t3 values(1,1),(2,2),(3,3);
|
||||
|
||||
select count(0)
|
||||
from
|
||||
(
|
||||
select t1.* from t1
|
||||
where ((
|
||||
(select count(1)
|
||||
from t2
|
||||
where t2.c1=t1.c1) +
|
||||
(select count(1)
|
||||
from t3
|
||||
where t3.c1=t1.c1)) > 0
|
||||
or t1.c1 = 5)
|
||||
) tmp_count;
|
||||
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
|
||||
Reference in New Issue
Block a user