Re: join condition against where with coalesce - Mailing list pgsql-general

From Tom Lane
Subject Re: join condition against where with coalesce
Date
Msg-id 26530.1163351604@sss.pgh.pa.us
Whole thread Raw
In response to join condition against where with coalesce  (Sim Zacks <sim@compulab.co.il>)
List pgsql-general
Sim Zacks <sim@compulab.co.il> writes:
> 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

Quite a lot: every A row is guaranteed to appear in the output of the
first query, but not in the second.  Consider for instance an A row that
only joins to b row(s) having typeid 13.

            regards, tom lane

pgsql-general by date:

Previous
From: Richard Broersma Jr
Date:
Subject: Re: Why overlaps is not working
Next
From: Tom Lane
Date:
Subject: Re: Why isn't it allowed to create an index in a schema other than public?