Re: How to hint 2 coulms IS NOT DISTINCT FROM each other - Mailing list pgsql-general

From David G. Johnston
Subject Re: How to hint 2 coulms IS NOT DISTINCT FROM each other
Date
Msg-id CAKFQuwYbb4KXyuKYL32LfUO3xbovce8zqJOrDd4xnp_kisL9Aw@mail.gmail.com
Whole thread Raw
In response to Re: How to hint 2 coulms IS NOT DISTINCT FROM each other  (Kim Rose Carlsen <krc@hiper.dk>)
List pgsql-general
On Fri, Oct 28, 2016 at 12:54 PM, Kim Rose Carlsen <krc@hiper.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.​

pgsql-general by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: How to hint 2 coulms IS NOT DISTINCT FROM each other
Next
From: Guyren Howe
Date:
Subject: SELECT DISTINCT ON removes results