pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: stan <stanb@panix.com>
Cc: pgsql-general@postgresql.org
Subject: Re: constrain with MATCH full and NULL values in referenced table
Date: Mon, 12 Aug 2019 11:27:28 -0400
Message-ID: <5361.1565623648@sss.pgh.pa.us> (raw)
In-Reply-To: <20190812151115.GA8819@panix.com>
References: <20190812151115.GA8819@panix.com>

stan <stanb@panix.com> writes:
> I am creating a table that has 2 values in it which are keys pointing to 2
> other tables. I need for the UNIQUE combination of these 2 keys to exist in
> a fourth table. It has been recommended to use a foreign key constraint with
> the MATCH FULL parameter. 
> Here is my question, does this deal with NULLS in the 4th table? I am
> concerned that this constraint might fail to reject an entry if one, or both
> of the 2 key values being inserted in the table are NULLS,.

If you don't want nulls there, maybe add NOT NULL constraints to those
columns?

			regards, tom lane





view thread (5+ messages)  latest in thread

Message-ID: <5361.1565623648@sss.pgh.pa.us>
Permalink:  ../5361.1565623648@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/5361.1565623648@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, stanb@panix.com
  Subject: Re: constrain with MATCH full and NULL values in referenced table
  In-Reply-To: <5361.1565623648@sss.pgh.pa.us>
  References: <20190812151115.GA8819@panix.com> <5361.1565623648@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox