From: | Alban Hertroys <dalroi(at)solfertje(dot)student(dot)utwente(dot)nl> |
---|---|
To: | Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com> |
Cc: | PostgreSQL general <pgsql-general(at)postgresql(dot)org> |
Subject: | MATCH FULL (Was: Re: Adding Foreign Key Constraint To Existing Table) |
Date: | 2011-07-02 10:32:00 |
Message-ID: | D8055F2A-21AF-4A9A-88C5-7BDCC375F707@solfertje.student.utwente.nl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 1 Jul 2011, at 23:10, Adrian Klaver wrote:
> http://www.postgresql.org/docs/9.0/interactive/sql-altertable.html
> Examples at bottom of page:
> "To add a foreign key constraint to a table:
> ALTER TABLE distributors ADD CONSTRAINT distfk FOREIGN KEY (address) REFERENCES addresses (address) MATCH FULL;
> "
Ah, so that's where my habit to add MATCH FULL to every FK constraint originated from! I'm pretty sure it doesn't serve any purpose in the above single-column constraint, or does it?
The docs say about MATCH:
"There are three match types: MATCH FULL, MATCH PARTIAL, and MATCH SIMPLE, which is also the default. MATCH FULL will not allow one column of a multicolumn foreign key to be null unless all foreign key columns are null. MATCH SIMPLE allows some foreign key columns to be null while other parts of the foreign key are not null. MATCH PARTIAL is not yet implemented."
Perhaps this warrants a documentation patch? It goes at least as far back as 8.2, the oldest online documentation on the site, maybe even as far back as 7.4 (the first version I used) or earlier.
Alban Hertroys
--
If you can't see the forest for the trees,
cut the trees and you'll see there is no forest.
!DSPAM:737,4e0ef3b012091559666998!
From | Date | Subject | |
---|---|---|---|
Next Message | Geoffrey Myers | 2011-07-03 10:00:48 | out of memory error |
Previous Message | Thom Brown | 2011-07-02 10:03:14 | Re: include directives in postgresql.conf |