Here is another test case that does not make use of the IN operator.
The common factor is now the use of co-routines to implement a subquery and
then evaluating that subquery more than once.

<blockquote><verbatim>
CREATE TABLE t1(a1, a2, a3);
CREATE INDEX t1a2 ON t1(a2, a1);
CREATE INDEX t1a3 ON t1(a3, a1);
CREATE TABLE t2(d);
INSERT INTO t1 VALUES(1, 1, 1), (2, 2, 2);
INSERT INTO t2 VALUES(22);
SELECT * FROM t1 WHERE (a2=1 OR a3=2) AND a1 = (
  SELECT d FROM (SELECT DISTINCT d FROM t2) WHERE d=22
);


This new test case demonstrates that checkin [8d663bfaaa4656c4f4ff1] is
not a solution to the problem.