Re: [NOVICE] Conditional constraint?

From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: Nick Haw <nick(dot)haw(at)operagrp(dot)com>, "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org>, "'pgsql-novice(at)postgresql(dot)org'" <pgsql-novice(at)postgresql(dot)org>, "'pgsql-novice(at)postgresql(dot)org'" <pgsql-novice(at)postgresql(dot)org>, "'pgsql-novice(at)postgresql(dot)org'" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: [NOVICE] Conditional constraint?
Date: 2002-03-08 18:37:28
Message-ID: web-821592@davinci.ethosmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-novice

Nick,

> What I want to do is make a field so that it requires a value after a
> change
> in another field to a particular value. Is this possible with the ADD
> CONSTRAINT command, or will I have to make a custom function and use
> a
> trigger.

That depends on how complicated your rules are. All constraints must
evaluate to a true/false statement, so complex procedures require a
function + trigger instead. How about posting some more details?

-Josh

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Francisco Reyes 2002-03-08 18:44:02 decimal(5) vs int8. Which more efficient.
Previous Message Jeff Anto 2002-03-08 18:15:14 a strange output from vacuum

Browse pgsql-novice by date

  From Date Subject
Next Message Brian 2002-03-08 19:04:30 Re: starting the postmaster
Previous Message Robert J. Sanford, Jr. 2002-03-08 18:05:19 Re: Good tutorial wanted...