Re: Should be easy enough to get this result (or is it possible?)... - Mailing list pgsql-general

From Tom Lane
Subject Re: Should be easy enough to get this result (or is it possible?)...
Date
Msg-id 678.1021524300@sss.pgh.pa.us
Whole thread Raw
In response to Should be easy enough to get this result (or is it possible?)...  (Sean Chittenden <sean@chittenden.org>)
List pgsql-general
Sean Chittenden <sean@chittenden.org> writes:
> The upshot of things being that I want the 2nd query below (f.foo =3D
> 'b') to return foo_id and foo.  Am I missing something?

I'm not real clear on what you're after, but the query results look
correct.  The LEFT JOIN result (without any WHERE restriction) is

test=# SELECT f.foo_id, f.foo, b.bar_id, b.bar
test-# FROM foo AS f LEFT JOIN bar AS b on (f.foo_id = b.foo_id);
 foo_id | foo | bar_id | bar
--------+-----+--------+-----
      1 | a   |      2 | y
      1 | a   |      1 | x
      1 | a   |      3 | z
      2 | b   |      4 | x
      2 | b   |      5 | z
      3 | c   |        |
(6 rows)

and so the restricted outputs with the WHERE clauses look right.
What were you trying to do exactly?

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Force a merge join?
Next
From: Lincoln Yeoh
Date:
Subject: Re: Force a merge join?