Thread: BUG #2862: ERROR: failed to build any 7-way joins

BUG #2862: ERROR: failed to build any 7-way joins

From
"Sergey"
Date:
The following bug has been logged online:

Bug reference:      2862
Logged by:          Sergey
Email address:      for.adv@gmail.com
PostgreSQL version: 8.2.0-1
Operating system:   Windows XP Pro SP2
Description:        ERROR:  failed to build any 7-way joins
Details:

After migrating to 8.2 I received an error:
ERROR: failed to build any 7-way joins
SQL state: XX000

STATEMENT:  select * from v_well_main w LEFT OUTER JOIN v_state_main s ON
(w."Id_well"=s."Id_wl") LEFT OUTER JOIN v_expl_main e ON
(w."Id_well"=e."Id_wl") where w."Id_dep"=7

View v_well_main contained statement:
 SELECT w."Id_well", w."Name_wl", w."Num", w."Cod", c."Name" AS
"Categor_name", w."Inv_num", w."Balance", w."Obl", w."Reg", w."Sl_rada",
w."Latitude_deg", w."Latitude_min", w."Latitude_sec", w."Longitude_deg",
w."Longitude_min", w."Longitude_sec", w."Topograf_note", w."Passp_org",
w."Passp_date", w."Executor", w."Exec_phone", w."Director", w."Al_rotor",
w."Al_gr", w."dP", o."Id_org", o."Name", o."Address", o."EDRPOU", o."Phone",
b."Name" AS name_obl, b."KOATUU" AS obl_koatuu, r."Name" AS name_raj,
r."KOATUU" AS raj_koatuu, s."Name" AS sl, v."Id_dep", v."Name_dep", v."Typ",
v.obj_typ, v."Begin", v."End"
   FROM v_well_obj v, "Categor_dic" c, "Well" w
   LEFT JOIN "Obl_dic" b ON w."Obl" = b."Id_obl"
   LEFT JOIN "Raj_dic" r ON w."Reg" = r."Id_raj"
   LEFT JOIN "Sl_rad_dic" s ON w."Sl_rada" = s."Id_s"
   LEFT JOIN "Org_dic" o ON w."Passp_org" = o."Id_org"
  WHERE v."Id_well" = w."Id_well" AND c."Id_cat" = w."Categor"
  ORDER BY w."Num";

The query was executed in pgAdmin III
If STATEMENT change to:
select * from v_well_main w where w."Id_dep"=113
then it executed OK

Re: BUG #2862: ERROR: failed to build any 7-way joins

From
Tom Lane
Date:
"Sergey" <for.adv@gmail.com> writes:
> After migrating to 8.2 I received an error:
> ERROR: failed to build any 7-way joins

I think this is already reported and fixed, but your test case looks a
bit different from the previous examples --- don't suppose you're in
a position to try it against CVS tip before we release 8.2.1?

            regards, tom lane