Skip site navigation (1) Skip section navigation (2)

FULL JOIN and mergjoinable conditions...

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Postgresql General <pgsql-general(at)postgresql(dot)org>
Subject: FULL JOIN and mergjoinable conditions...
Date: 2004-06-30 01:13:32
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
Today I got the error:

ERROR:  FULL JOIN is only supported with mergejoinable join conditions

Which is really annoying since a full join is exactly what I wanted. I
guess the alternative is to do a left join and a right join and merge
them? Is it just that no-one has come up with a way to code this

Maybe someone has a better way to express this. The problem is I have
two tables with ranges and I wanted to generate a result with the
overlaps and blanks where there are things missed. For example:

Table A                             Table B
Tag   Start    End                  Tag   Start    End
A       1       2                    A     2        7
B       6       9                    B     9        9
C      10      12                    C    13       15

So the query looks like:

SELECT * from A full outer join B on (a.end >= b.start and b.end >= a.start)

The result would be something like:

A       1      2      A      2      7
B       6      9      A      2      7
B       6      9      B      9      9
C      10     12      \N     \N    \N
\N     \N     \N      C      13    15

Any ideas?
Martijn van Oosterhout   <kleptog(at)svana(dot)org>
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.


pgsql-general by date

Next:From: Tom LaneDate: 2004-06-30 02:50:56
Subject: Re: query failing with out of memory error message.
Previous:From: Jason SheetsDate: 2004-06-30 00:49:32
Subject: Re: what happened to

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group