Hi!
Rather simple script (original query was a 500 lines of SQL with >100 Mb of
gzipped dump. Query is looked strange, but actually it was auto-generated):
CREATE TABLE t (a int, b int);
CREATE TABLE tt (c int);
INSERT INTO t VALUES (1,1), (2,2);
INSERT INTO tt VALUES (2);
SELECT *
FROM t
WHERE ( CASE WHEN a%2 IN (SELECT c FROM tt) THEN a END IN (SELECT c FROM tt)
);
I suppose, the problem is connected to hashed subplan, but I'm not very familiar
with executor. And this affects all supported versions of pgsql.
--
Teodor Sigaev E-mail: teodor@sigaev.ru
WWW: http://www.sigaev.ru/