Hi!

I faced with planner error:
ERROR:  could not find RelOptInfo for given relids

A test case is in attachment, all supported versions of pgsql and HEAD are affected.

Suppose, there is something wrong in pull_up_sublinks_qual_recurse() near converting NOT EXISTS into join, because preventing such convertion makes query worked. But I'm not sure.



--
Teodor Sigaev                                   E-mail: teo...@sigaev.ru
                                                   WWW: http://www.sigaev.ru/
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t3;
DROP TABLE IF EXISTS t4;
DROP TABLE IF EXISTS t5;

CREATE TABLE t1 (
    c1 int
);

CREATE TABLE t2 (
    c1 int,
    c2 int,
    c3 int
);

CREATE TABLE t3 (
    c1 int,
    c2 int
);

CREATE TABLE t4 (
    c1 int,
    c2 int
);

CREATE TABLE t5 (
    c1 int
);

SELECT
    *
FROM
    t1
WHERE
    NOT (
        EXISTS (
            SELECT
                1
            FROM (
                    SELECT
                        t2.c2 AS c1
                    FROM
                        t2 
                        LEFT OUTER JOIN t3 ON (t2.c3 = t3.c1 )
                        LEFT OUTER JOIN (
                                SELECT
                                    t5.c1 AS c1
                                FROM
                                    t4
                                LEFT OUTER JOIN t5 ON ( t4.c2 = t5.c1 )
                                                )
                        a1 ON ( a1.c1 = t3.c2  )
                                ) a2
            WHERE
                t1.c1 = a2.c1 
                )
        );
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to