pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Szűcs Gábor <surrano@gmail.com>
Cc: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Cc: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: Re: [SQL] could not devise a query plan
Date: Tue, 24 May 2005 14:12:25 -0400
Message-ID: <4474.1116958345@sss.pgh.pa.us> (raw)
In-Reply-To: <42930447.2030801@gmail.com>
References: <05d801c41bd8$daf4f8f0$0403a8c0@fejleszt4>
	<42930447.2030801@gmail.com>

=?ISO-8859-2?Q?Sz=FBcs_G=E1bor?= <surrano@gmail.com> writes:
> ABSTRACT: The following query fails.

> 	SELECT * FROM
> 	  (SELECT a,b FROM cdqp WHERE a=1 AND b=2) AS aa
> 	  NATURAL FULL JOIN
> 	  (SELECT a,b FROM cdqp WHERE a=1 and b=2) AS bb
> 	WHERE a+b = 3;

Thanks for the report!  Seems I overlooked a case when fixing the
original report last year.  Patch for 8.0 attached (it's the same in
7.4 too).

			regards, tom lane

inline patch 1: joinpath.c (+1/-6 lines) download inline-1.patchIndex: joinpath.c =================================================================== RCS file: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v retrieving revision 1.91.4.1 diff -c -r1.91.4.1 joinpath.c *** joinpath.c 23 Jan 2005 02:22:27 -0000 1.91.4.1 --- joinpath.c 24 May 2005 17:54:15 -0000 *************** *** 498,512 **** * nestloop path, but since mergejoin is our only join type that * supports FULL JOIN, it's necessary to generate a clauseless * mergejoin path instead. - * - * Unfortunately this can't easily be extended to handle the case - * where there are joinclauses but none of them use mergejoinable - * operators; nodeMergejoin.c can only do a full join correctly if - * all the joinclauses are mergeclauses. */ if (mergeclauses == NIL) { ! if (jointype == JOIN_FULL && restrictlist == NIL) /* okay to try for mergejoin */ ; else continue; --- 498,507 ---- * nestloop path, but since mergejoin is our only join type that * supports FULL JOIN, it's necessary to generate a clauseless * mergejoin path instead. */ if (mergeclauses == NIL) { ! if (jointype == JOIN_FULL) /* okay to try for mergejoin */ ; else continue;

view thread (7+ messages)

Message-ID: <4474.1116958345@sss.pgh.pa.us>
Permalink:  ../4474.1116958345@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/4474.1116958345@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, surrano@gmail.com, pgsql-bugs@postgresql.org
  Subject: Re: [SQL] could not devise a query plan
  In-Reply-To: <4474.1116958345@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