v.25.12New Feature

Allow the use of non-constant second arguments for IN operator

Allows the use of non-constant second arguments for IN. It also supports a tuple as a second argument. #77906 (Yarik Briukhovetskyi).
Allows the use of non-constant second arguments for IN expressions and supports tuples as the second argument in IN.

Why it matters

This feature addresses the limitation where the IN operator only accepted constant arrays or sets as its second argument. By enabling non-constant and tuple arguments, users can write more flexible and dynamic queries, improving expressiveness and simplifying queries where the set of values to compare against is computed or derived from subqueries.

How to use it

Simply use the IN operator with a non-constant second argument, such as a subquery or tuple, in your SQL queries, for example:

SELECT  FROM table WHERE column IN (SELECT id FROM other_table);

or

SELECT  FROM table WHERE (col1, col2) IN ((1, 2), (3, 4));