Re: How to hint 2 coulms IS NOT DISTINCT FROM each other

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Kim Rose Carlsen <krc(at)hiper(dot)dk>
Cc: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to hint 2 coulms IS NOT DISTINCT FROM each other
Date: 2016-10-28 20:07:22
Message-ID: CAKFQuwYbb4KXyuKYL32LfUO3xbovce8zqJOrDd4xnp_kisL9Aw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Oct 28, 2016 at 12:54 PM, Kim Rose Carlsen <krc(at)hiper(dot)dk> wrote:

> ​​
>
> CREATE VIEW view_circuit_with_status AS (
> SELECT r.*,
> s.circuit_status,
> s.customer_id AS s_customer_id,
> p.line_speed,
> p.customer_id AS p_customer_id
> FROM view_circuit r
> JOIN view_circuit_product_main s
> ON r.circuit_id = s.circuit_id
> AND r.customer_id IS NOT DISTINCT FROM s.customer_id
> JOIN view_circuit_product p
> ON r.circuit_id = p.circuit_id
> AND r.customer_id IS NOT DISTINCT FROM s.customer_id
> );
>
> SELECT * FROM view_circuit_with_status WHERE customer_id = 1;
>
>
​A couple of random thoughts:

1.
TABLE circuit (circuit_id)
TABLE customer (customer_id)
TABLE circuit_customer (circuit_id, customer_id)

2.
INSERT INTO customer (0, 'Customer number standing in for customer not
assigned');

While IS DISTINCT FROM could very well use some more love I surmise the
reason it hasn't gotten it is because most data model set things up so that
it never needs to be used.

​David J.​

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Guyren Howe 2016-10-28 20:39:19 SELECT DISTINCT ON removes results
Previous Message Merlin Moncure 2016-10-28 20:05:19 Re: How to hint 2 coulms IS NOT DISTINCT FROM each other