pgsql: Add assertion to verify derived clause has constant RHS

From: Amit Langote <amitlan(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add assertion to verify derived clause has constant RHS
Date: 2025-04-04 02:34:48
Message-ID: E1u0WtM-002Yc0-1M@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add assertion to verify derived clause has constant RHS

find_derived_clause_for_ec_member() searches for a previously-derived
clause that equates a non-constant EquivalenceMember to a constant.
It is only called for EquivalenceClasses with ec_has_const set, and
with a non-constant member the EquivalenceMember to search for.

The matched clause is expected to have the non-constant member on the
left-hand side and the constant EquivalenceMember on the right.

Assert that the RHS is indeed a constant, to catch violations of this
structure and enforce assumptions made by
generate_base_implied_equalities_const().

Author: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
Reviewed-by: Amit Langote <amitlangote09(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAExHW5scMxyFRqOFE6ODmBiW2rnVBEmeEcA-p4W_CyuEikURdA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/887160d1beaec607187261ab1a9411040da3d7b5

Modified Files
--------------
src/backend/optimizer/path/equivclass.c | 3 +++
1 file changed, 3 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Tomas Vondra 2025-04-04 02:50:11 pgsql: Revert "Improve accounting for memory used by shared hash tables
Previous Message Tomas Vondra 2025-04-04 00:41:40 Re: pgsql: Improve accounting for memory used by shared hash tables