Re: Make transformAExprIn() return a flattened bool expression directly

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: ZizhuanLiu X-MAN <44973863(at)qq(dot)com>
Cc: cca5507 <cca5507(at)qq(dot)com>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Make transformAExprIn() return a flattened bool expression directly
Date: 2026-07-01 22:21:15
Message-ID: 3651977.1782944475@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"=?utf-8?B?Wml6aHVhbkxpdSBYLU1BTg==?=" <44973863(at)qq(dot)com> writes:
> 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().

Just for the record, I think this is a bad idea that we should reject.
In general, it is not the business of the parser to perform
optimizations. Where we have done that, we've often regretted it.

In the specific case at hand, doing this is presupposing that all
parse- and rewrite-time logic is capable of dealing with non-binary
AND and OR nodes. That seems like a significant risk to me.
At the very least it seems likely to lead to unexpected changes
in view dump output.

In exchange for taking that nonzero risk, what are we buying?
You've offered no evidence of a meaningful or even measurable
improvement.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2026-07-01 22:33:45 Re: Making the ENUM operators LEAKPROOF
Previous Message Zsolt Parragi 2026-07-01 22:19:51 Re: [PATCH] Add pg_get_table_ddl() to reconstruct CREATE TABLE statements