X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id E8EA8D1CAF7 for ; Wed, 17 Dec 2003 15:33:07 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 45973-03 for ; Wed, 17 Dec 2003 11:32:40 -0400 (AST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id ADE26D1C990 for ; Wed, 17 Dec 2003 11:32:35 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id hBHFWN19028103; Wed, 17 Dec 2003 10:32:23 -0500 (EST) To: "Alessandro Depase" Cc: pgsql-sql@postgresql.org Subject: Re: failed to build any 5-way joins In-reply-to: <001e01c3c3ca$4c0c4af0$0200a8c0@dedalus1> References: <001e01c3c3ca$4c0c4af0$0200a8c0@dedalus1> Comments: In-reply-to "Alessandro Depase" message dated "Tue, 16 Dec 2003 12:46:49 +0100" Date: Wed, 17 Dec 2003 10:32:23 -0500 Message-ID: <28102.1071675143@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200312/123 X-Sequence-Number: 16289 "Alessandro Depase" writes: > select * > from info where parent_infoid is null=20 > and fieldtypeid in (select fieldtypeid from users_auth_groups uag1, field_a= > uth fa where userid =3D 8 and fa.groupid =3D uag1.groupid)=20 > and main_infoid in (select ic.infoid from info_category ic, category_auth c= > a, users_auth_groups uag2=20 > where ic.categoryid =3D ca.categoryid and uag2.userid =3D 8 and uag2.grou= > pid =3D ca.groupid and read_write =3D 'W')=20 Hmm. It's right, there's no way to construct a sub-plan that joins just that number of relations, because of the constraint that the IN sub-selects have to be fully formed before we can do IN processing. A brute force solution is to just remove the error cross-check in src/backend/optimizer/path/joinrels.c: if (result_rels == NIL) elog(ERROR, "failed to build any %d-way joins", level); I'll probably install some less-drastic fix for 7.4.1, but if you need a solution right now, that will get you going. regards, tom lane