join condition against where with coalesce

From: Sim Zacks <sim(at)compulab(dot)co(dot)il>
To: pgsql-general(at)postgresql(dot)org
Subject: join condition against where with coalesce
Date: 2006-11-12 08:29:02
Message-ID: ej6m1n$1qep$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Should there be any difference between:

select * from table1 a left join table2 b on a.pk=b.fk and b.typeid=14
and
select * from table1 a left join table2 b on a.pk=b.fk
where coalesce(b.typeid,14)=14

The reason I need to use the coalesce is because my goal is to do it with a full join and can't use
the and condition because it is not merge-joinable.

My test with the left join showed me that with the where it doesn't give any results, while I would
expect it to give me all the results in the first table.

Any thoughts?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sim Zacks 2006-11-12 09:01:09 Re: join condition against where with coalesce
Previous Message Shoaib Mir 2006-11-12 08:03:33 Re: encoding advice requested