From: | Dennis Gearon <gearond(at)fireserve(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org, Ben <bench(at)silentmedia(dot)com> |
Subject: | Re: database constraints |
Date: | 2004-10-06 15:58:14 |
Message-ID: | 41641616.7050909@fireserve.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)silentmedia(dot)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 -------------------------------------------------------------->
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2004-10-06 16:00:16 | Re: Cache lookup failed for relation, when trying to DROP |
Previous Message | Alessandro Vincelli | 2004-10-06 15:45:09 | passing new.* in trigger |