pgsql: Fix join-removal logic for pseudoconstant and outerjoin-delayed

Поиск
Список
Период
Сортировка
От tgl@postgresql.org (Tom Lane)
Тема pgsql: Fix join-removal logic for pseudoconstant and outerjoin-delayed
Дата
Msg-id 20100914231537.32FEE7541E2@cvs.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Log Message:
-----------
Fix join-removal logic for pseudoconstant and outerjoin-delayed quals.

In these cases a qual can get marked with the removable rel in its
required_relids, but this is just to schedule its evaluation correctly, not
because it really depends on the rel.  We were assuming that, in effect,
we could throw away *all* quals so marked, which is nonsense.  Tighten up
the logic to be a little more paranoid about which quals belong to the
outer join being considered for removal, and arrange for all quals that
don't belong to be updated so they will still get evaluated correctly.

Also fix another problem that happened to be exposed by this test case,
which was that make_join_rel() was failing to notice some cases where
a constant-false qual could be used to prove a join relation empty.  If it's
a pushed-down constant false, then the relation is empty even if it's an
outer join, because the qual applies after the outer join expansion.

Per report from Nathan Grange.  Back-patch into 9.0.

Tags:
----
REL9_0_STABLE

Modified Files:
--------------
    pgsql/src/backend/optimizer/path:
        joinrels.c (r1.105 -> r1.105.4.1)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/path/joinrels.c?r1=1.105&r2=1.105.4.1)
    pgsql/src/backend/optimizer/plan:
        analyzejoins.c (r1.3 -> r1.3.2.1)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/plan/analyzejoins.c?r1=1.3&r2=1.3.2.1)
    pgsql/src/backend/optimizer/util:
        joininfo.c (r1.52 -> r1.52.6.1)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/util/joininfo.c?r1=1.52&r2=1.52.6.1)
    pgsql/src/include/optimizer:
        joininfo.h (r1.38 -> r1.38.6.1)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/optimizer/joininfo.h?r1=1.38&r2=1.38.6.1)
    pgsql/src/test/regress/expected:
        join.out (r1.46 -> r1.46.2.1)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/join.out?r1=1.46&r2=1.46.2.1)
    pgsql/src/test/regress/sql:
        join.sql (r1.35 -> r1.35.2.1)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/sql/join.sql?r1=1.35&r2=1.35.2.1)

В списке pgsql-committers по дате отправления:

Предыдущее
От: tgl@postgresql.org (Tom Lane)
Дата:
Сообщение: pgsql: Fix join-removal logic for pseudoconstant and outerjoin-delayed
Следующее
От: heikki@postgresql.org (Heikki Linnakangas)
Дата:
Сообщение: pgsql: Don't call OwnLatch while holding a spinlock.