From: | Michael Fuhr <mike(at)fuhr(dot)org> |
---|---|
To: | "Kashmira Patel (kupatel)" <kupatel(at)cisco(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Question about check constraints |
Date: | 2006-01-28 00:40:22 |
Message-ID: | 20060128004022.GA20476@winnie.fuhr.org |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Fri, Jan 27, 2006 at 03:06:26PM -0800, Kashmira Patel (kupatel) wrote:
> I have a table where two columns have two different check constraints
> associated with them. When I update one column, the check constraint on
> the other column is also executed. Is there a way to avoid this? I want
> to check only for the condition defined for the column being updated.
I don't think you can change this behavior: each CHECK constraint
is evaluated for the new row regardless of whether a particular
column changed or not. However, you could enforce the constraints
with a trigger and skip checks where NEW.column is the same as
OLD.column.
Why the concern? Are the checks expensive? Do they have side
effects? What do they do?
--
Michael Fuhr
From | Date | Subject | |
---|---|---|---|
Next Message | Kashmira Patel (kupatel) | 2006-01-28 01:46:11 | Re: Question about check constraints |
Previous Message | Kashmira Patel (kupatel) | 2006-01-27 23:06:26 | Question about check constraints |