Re: 9.0RC1 error variable not found in subplan target lists

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: 9.0RC1 error variable not found in subplan target lists
Дата
Msg-id 3167.1285455971@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: 9.0RC1 error variable not found in subplan target lists  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: 9.0RC1 error variable not found in subplantarget lists  ("Andrus" <kobruleht2@hot.ee>)
Список pgsql-general
> "Andrus" <kobruleht2@hot.ee> writes:
>> Should I try 9.0 release

> No, it's still busted in HEAD :-(.  Probably won't be too hard to fix,
> but I need to go find the bug.

Here's the patch if it helps.

            regards, tom lane

diff --git a/src/backend/optimizer/plan/analyzejoins.c b/src/backend/optimizer/plan/analyzejoins.c
index 5fc056e2a572db2299f2624f19e8988e671df034..1355c18317a7399e028c16f3b8edffc410687a27 100644
*** a/src/backend/optimizer/plan/analyzejoins.c
--- b/src/backend/optimizer/plan/analyzejoins.c
***************
*** 26,31 ****
--- 26,32 ----
  #include "optimizer/pathnode.h"
  #include "optimizer/paths.h"
  #include "optimizer/planmain.h"
+ #include "optimizer/var.h"

  /* local functions */
  static bool join_is_removable(PlannerInfo *root, SpecialJoinInfo *sjinfo);
*************** join_is_removable(PlannerInfo *root, Spe
*** 197,212 ****
      }

      /*
!      * Similarly check that the inner rel doesn't produce any PlaceHolderVars
!      * that will be used above the join.
       */
      foreach(l, root->placeholder_list)
      {
          PlaceHolderInfo *phinfo = (PlaceHolderInfo *) lfirst(l);

!         if (bms_is_subset(phinfo->ph_eval_at, innerrel->relids) &&
!             !bms_is_subset(phinfo->ph_needed, joinrelids))
!             return false;
      }

      /*
--- 198,220 ----
      }

      /*
!      * Similarly check that the inner rel isn't needed by any PlaceHolderVars
!      * that will be used above the join.  We only need to fail if such a PHV
!      * actually references some inner-rel attributes; but the correct check
!      * for that is relatively expensive, so we first check against ph_eval_at,
!      * which must mention the inner rel if the PHV uses any inner-rel attrs.
       */
      foreach(l, root->placeholder_list)
      {
          PlaceHolderInfo *phinfo = (PlaceHolderInfo *) lfirst(l);

!         if (bms_is_subset(phinfo->ph_needed, joinrelids))
!             continue;            /* PHV is not used above the join */
!         if (!bms_overlap(phinfo->ph_eval_at, innerrel->relids))
!             continue;            /* it definitely doesn't reference innerrel */
!         if (bms_overlap(pull_varnos((Node *) phinfo->ph_var),
!                         innerrel->relids))
!             return false;        /* it does reference innerrel */
      }

      /*

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: 9.0RC1 error variable not found in subplan target lists
Следующее
От: Ian Barwick
Дата:
Сообщение: Re: A note on pg_upgrade and missing "pg_upgrade_support.so"