Interesting problem, seems to be planer related:
select 1
          from beitraege bei,
                   b_zuordnungen bz,
           (select bei_id 
             from b_zuordnungen bz, 
                  ben_zuordnungen z, 
                  strukturelemente se 
            where se.id = z.str_id 
              and se.sty_id = (select id from strukturtypen where code='GEO') 
              and z.str_id = bz.str_id 
              and z.ben_id = 100
            union 
            select id from beitraege where kz_edit <> 'N' and useraend = 100
           ) as foo
          where bz.bei_id = bei.id      
        and foo.bei_id = bei.id
        and bei.red_id in (select gba.grp_id
                     from grp_ben_applikationen gba,
                          grp_gruppen grp
                    where grp.id = gba.grp_id
                      and grp.kz_aktiv='J'
                      and gba.app_id in (select id from grp_applikationen where 
code in ('app1', 'app2')) 
                      and gba.ben_id = 100)
                and (bei.bei_id_frei is null or bei.kz_edit='N')
        and (bei.bt_id, bz.str_id) in ((96,1259036), (96,2688382) )
        and bei.red_id=1777712
        and bei.id in (
                              select bzu.bei_id
                                from b_zuordnungen bzu,
                                     strukturelemente se
                               where bzu.str_id = se.id
                                 and se.id = 1773715
            )
         and bei.id=10157309;
ERROR:  failed to build any 8-way joins

Interesting: remove any of the above where conditions solves  the problem go 
away, e.g. removing "and bei.id=10157309".

Testet with 8.2.1 and 8.1.4, same effect on both systems. Because of the large 
number of tables involved it's difficult to find a self contained patch, but if 
necessary I'll give it a try.
I could give 8.2.3 a try, but I doubt this will help. 

Any ideas?

Regards
Mario Weilguni

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to