>From: cca5507 <[email protected]> >Date: 2026-04-30 18:16 >To: Chao Li <[email protected]> >Cc: pgsql-hackers <[email protected]> >Subject: Re: Make transformAExprIn() return a flattened bool expression directly > > > Hi Chao, > >Thanks for your comments. I have created a CF entry: > >https://commitfest.postgresql.org/patch/6723/ > >-- >Regards, >ChangAo Chen
Hi, ChangAo, Chao, Hackers, `` Thanks a lot for the suggestion to avoid nested structures in transformAExprIn(). I also agree that handling this kind of simplification during parsing is cleaner and more appropriate, even though the planner can achieve a similar effect later via preprocess_qual_conditions(). `` I further refined and polished this implementation based on v1 patch. I intentionally keep all the core logic inside the existing foreach(l, rexprs) loop. This way better preserves the integrity of the function, minimizes code intrusion, and makes the overall logic easier to follow. I put careful thought into this implementation, and more details are documented in the code comments. `` I have updated the patch accordingly and prepared corresponding test cases to cover the modified scenarios, ensuring the correctness and stability of the optimization. `` Any feedback and further suggestions are highly appreciated. create table t1(id int); create table t2(id int); create table t3(id int); explain select t1.* from t1, t2, t3 where t1.id in (1); explain select t1.* from t1, t2, t3 where t1.id in (1,1); explain select t1.* from t1, t2, t3 where t1.id in (t2.id); explain select t1.* from t1, t2, t3 where t1.id in (t2.id, t2.id); explain select t1.* from t1, t2, t3 where t1.id in (1, t2.id, t2.id, 1); explain select t1.* from t1, t2, t3 where (t1.id,t2.id) in ((1, 11)); explain select t1.* from t1, t2, t3 where (t1.id,t2.id) in ((1,11),(1,11)); explain select t1.* from t1, t2, t3 where (t1.id,t2.id) in ((t2.id, t2.id)); explain select t1.* from t1, t2, t3 where (t1.id,t2.id) in ((t2.id, t2.id),(t2.id, t2.id)); explain select t1.* from t1, t2, t3 where (t1.id,t2.id) in ((1,11), (t2.id, t2.id),(t2.id, t2.id), (1,11)); Thanks, -- ZizhuanLiu (X-MAN) [email protected]
v2-0001-Make-transformAExprIn-return-a-flattened-bool-exp.patch
Description: Binary data
