Re: BUG #14733: unexpected query result

From: bricklen <bricklen(at)gmail(dot)com>
To: mtv(dot)spec(at)gmail(dot)com
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14733: unexpected query result
Date: 2017-07-04 15:21:42
Message-ID: CAGrpgQ_t+wWvBGu3dvxpG3JjgdLTXO32h7pojpmsqtjC6zC6hg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, Jul 4, 2017 at 4:19 AM, <mtv(dot)spec(at)gmail(dot)com> wrote:

> Query:
>
> SELECT
> o.id,
> c.name,
> o.amount
> FROM
> test.e_order o,
> test.e_customer c
> WHERE o.e_customer_id = c.id OR
> o.e_customer_id IS NULL
> ORDER BY o.id ASC;
>
> Expected result:
>
> ---------------------
> | id | name | amount |
> ---------------------
> | 1 | John | 1000 |
> ---------------------
> | 2 | | 2000 |
> ---------------------
>

If you want that result try revising your query.
select e.id, c.name, e.amount
from test.e_order as e
left join test.e_customer as c on c.id=e.e_customer_id;

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Eisentraut 2017-07-05 01:14:40 Re: [PATCH] Refresh documentation for psql
Previous Message Tom Lane 2017-07-04 15:14:59 Re: BUG #14733: unexpected query result