Re: Replace IN VALUES with ANY in WHERE clauses during optimization - Mailing list pgsql-hackers

From Alena Rybakina
Subject Re: Replace IN VALUES with ANY in WHERE clauses during optimization
Date
Msg-id d6809313-c0ca-4338-88e5-e8bc424bdfda@postgrespro.ru
Whole thread Raw
In response to Re: Replace IN VALUES with ANY in WHERE clauses during optimization  (Alena Rybakina <a.rybakina@postgrespro.ru>)
List pgsql-hackers

Hi!

On 09.02.2025 18:38, Alexander Korotkov wrote:
Also, aren't we too restrictive while requiring is_simple_values_sequence()?
For instance, I believe cases like this (containing Var) could be transformed too.

select * from t t1, lateral (select * from t t2 where t2.i in (values (t1.i), (1)));
I'm still working on it.
Also, I think there is quite a code duplication about construction of
SAOP between match_orclause_to_indexcol() and convert_VALUES_to_ANY()
functions.  I would like to see a refactoring as a separate first
patch, which extracts the common part into a function.

Done.

I have attached a patch. In addition to the transfer, I added the process of searching for a suitable operator and type for the left expression for input expressions: const and left expression, since they may differ from the declared types. Additionally, we convert the left expr to a type suitable for the found operator.

-- 
Regards,
Alena Rybakina
Postgres Professional
Attachment

pgsql-hackers by date:

Previous
From: Markus Wanner
Date:
Subject: Reset the output buffer after sending from WalSndWriteData
Next
From: Noah Misch
Date:
Subject: Re: pg_trgm comparison bug on cross-architecture replication due to different char implementation