Re: database constraints - Mailing list pgsql-general

From Dennis Gearon
Subject Re: database constraints
Date
Msg-id 41641616.7050909@fireserve.net
Whole thread Raw
In response to database constraints  (Ben <bench@silentmedia.com>)
List pgsql-general
Use a post trigger function, ON UPDATE, INSERT which essentially has
this in it:

if ( ISNULL(new.a) AND ISNULL(new.b) ){ RAISE NOTICE "blah blah"; }

I work with PHP a lot, just a little plpgsql, so, the grammar may be
wrong above.
Ben <bench@silentmedia.com> wrote:
<quote --------------------------------------------------------------->
If I have have the table:

create table foo
(
    a int references bar(id),
    b int references baz(id)
)

... how do I make sure one and only one of the columns a and b are
non-null? Is it even reasonable?
</quote -------------------------------------------------------------->

pgsql-general by date:

Previous
From: Mark Gibson
Date:
Subject: Re: Cache lookup failed for relation, when trying to DROP
Next
From: Tom Lane
Date:
Subject: Re: Cache lookup failed for relation, when trying to DROP