Re: Cannot do time-aligned listing with FULL JOIN, get ERROR: FULL JOIN is only supported with merge-joinable join conditions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "John Koerber" <johnk(at)musicreports(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org, "'Roger Ging'" <rging(at)musicreports(dot)com>
Subject: Re: Cannot do time-aligned listing with FULL JOIN, get ERROR: FULL JOIN is only supported with merge-joinable join conditions
Date: 2009-11-05 22:14:40
Message-ID: 3595.1257459280@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

"John Koerber" <johnk(at)musicreports(dot)com> writes:
> SELECT *
> FROM public.events_a A
> FULL JOIN public.events_b B
> ON (start_a, end_a) OVERLAPS (start_b, end_b)
> ORDER BY coalesce(start_a, start_b), start_b ;
> [ doesn't work ]

> In practice, is there:
> * A different structuring the time spans of the 'events' such that a
> merge-joinable condition can be found?
> * A possibility of teaching Hash Join to do the FULL JOIN on
> non-merge-joinable conditions?

Even if we could do full joins by hashing, that wouldn't help you since
OVERLAPS is no more hashable than it is mergeable. The only possible
join plan would be nestloop, with a work table the size of the inner
input to keep track of which inner rows hadn't been joined to anything
:-(

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Brian Modra 2009-11-06 05:10:59 Re: SQL Server
Previous Message John Koerber 2009-11-05 21:48:12 Cannot do time-aligned listing with FULL JOIN, get ERROR: FULL JOIN is only supported with merge-joinable join conditions