fix fulljoin rewrite for expression alias
This commit is contained in:
@ -3556,6 +3556,7 @@ static Node* reduce_inequality_fulljoins_jointree_recurse(PlannerInfo* root, Nod
|
|||||||
} break;
|
} break;
|
||||||
default:
|
default:
|
||||||
oldvar = (Node*)copyObject(node);
|
oldvar = (Node*)copyObject(node);
|
||||||
|
oldvar = eval_const_expressions(root, oldvar);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
31
src/test/regress/expected/fulljoin_rewrite.out
Normal file
31
src/test/regress/expected/fulljoin_rewrite.out
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
create table fulljoin_test(w_zip text);
|
||||||
|
create table fulljoin_test2(w_name varchar(20),w_tax int,w_street_2 varchar(50));
|
||||||
|
create table fulljoin_test3(d_id int);
|
||||||
|
create table fulljoin_test4(w_id int,w_ytd numeric(6,2));
|
||||||
|
SELECT
|
||||||
|
fulljoin_test3.d_id
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
alias2.w_name alias6 ,
|
||||||
|
alias2.w_tax alias7,
|
||||||
|
MOD(fulljoin_test4.w_id,
|
||||||
|
fulljoin_test4.w_ytd + 10) alias8
|
||||||
|
FROM
|
||||||
|
fulljoin_test alias1
|
||||||
|
FULL JOIN fulljoin_test2 alias2 ON
|
||||||
|
alias1.w_zip = alias2.w_street_2,
|
||||||
|
fulljoin_test4)alias9
|
||||||
|
FULL JOIN fulljoin_test3 ON
|
||||||
|
alias9.alias7 != fulljoin_test3.d_id
|
||||||
|
WHERE
|
||||||
|
alias9.alias8 = 2
|
||||||
|
OR alias9.alias7 = 2;
|
||||||
|
d_id
|
||||||
|
------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
drop table fulljoin_test;
|
||||||
|
drop table fulljoin_test2;
|
||||||
|
drop table fulljoin_test3;
|
||||||
|
drop table fulljoin_test4;
|
@ -1012,3 +1012,4 @@ test: rename_table
|
|||||||
|
|
||||||
# debug instrument
|
# debug instrument
|
||||||
test: test_debug5
|
test: test_debug5
|
||||||
|
test: fulljoin_rewrite
|
35
src/test/regress/sql/fulljoin_rewrite.sql
Normal file
35
src/test/regress/sql/fulljoin_rewrite.sql
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
create table fulljoin_test(w_zip text);
|
||||||
|
|
||||||
|
create table fulljoin_test2(w_name varchar(20),w_tax int,w_street_2 varchar(50));
|
||||||
|
|
||||||
|
create table fulljoin_test3(d_id int);
|
||||||
|
|
||||||
|
create table fulljoin_test4(w_id int,w_ytd numeric(6,2));
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
fulljoin_test3.d_id
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
alias2.w_name alias6 ,
|
||||||
|
alias2.w_tax alias7,
|
||||||
|
MOD(fulljoin_test4.w_id,
|
||||||
|
fulljoin_test4.w_ytd + 10) alias8
|
||||||
|
FROM
|
||||||
|
fulljoin_test alias1
|
||||||
|
FULL JOIN fulljoin_test2 alias2 ON
|
||||||
|
alias1.w_zip = alias2.w_street_2,
|
||||||
|
fulljoin_test4)alias9
|
||||||
|
FULL JOIN fulljoin_test3 ON
|
||||||
|
alias9.alias7 != fulljoin_test3.d_id
|
||||||
|
WHERE
|
||||||
|
alias9.alias8 = 2
|
||||||
|
OR alias9.alias7 = 2;
|
||||||
|
|
||||||
|
drop table fulljoin_test;
|
||||||
|
|
||||||
|
drop table fulljoin_test2;
|
||||||
|
|
||||||
|
drop table fulljoin_test3;
|
||||||
|
|
||||||
|
drop table fulljoin_test4;
|
Reference in New Issue
Block a user