Re: ERROR: FULL JOIN is only supported with merge-joinable join conditions

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Harco de Hilster <harcoh(at)ATConsultancy(dot)nl>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: ERROR: FULL JOIN is only supported with merge-joinable join conditions
Date: 2006-03-16 20:17:09
Message-ID: 20060316201709.GB4474@ns.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

* Harco de Hilster (harcoh(at)ATConsultancy(dot)nl) wrote:
> ERROR: FULL JOIN is only supported with merge-joinable join conditions

I'm not a big fan of that error either, honestly.

> select *
> from A
> full outer join B on A.f1 = B.f1 and ((A.ExpTime IS NULL AND B.ExpTime
> IS NULL) OR (A.ModTime <= B.ExpTime AND (B.ExpTime > A.ExpTime OR
> B.ExpTime IS NULL)))

What about:

inner join
union all
left join
union all
right join

? You'd need to add a couple where clauses to make the left/right joins
only return rows not returned by the inner join. Honestly, that setup
is pretty ugly though and you might consider trying to figure out a way
to clean it up.

It'd be nice if Postgres would basically just do this for you. :/
Perhaps one of the other folks can explain why it doesn't just work.

Enjoy,

Stephen

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2006-03-16 20:36:45 Re: How do I make a timestamp column default to current time
Previous Message Ing. Claudio Roberto Seu 2006-03-16 20:17:01 pregunta de principiante