pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alessandro Depase <alessandro.depase@libero.it>
Cc: pgsql-sql@postgresql.org
Subject: Re: failed to build any 5-way joins
Date: Wed, 17 Dec 2003 10:32:23 -0500
Message-ID: <28102.1071675143@sss.pgh.pa.us> (raw)
In-Reply-To: <001e01c3c3ca$4c0c4af0$0200a8c0@dedalus1>
References: <001e01c3c3ca$4c0c4af0$0200a8c0@dedalus1>

"Alessandro Depase" <alessandro.depase@libero.it> 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



view thread (8+ messages)  latest in thread

Message-ID: <28102.1071675143@sss.pgh.pa.us>
Permalink:  ../28102.1071675143@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/28102.1071675143@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, alessandro.depase@libero.it
  Subject: Re: failed to build any 5-way joins
  In-Reply-To: <28102.1071675143@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox