Check constraint

From: Francisco Reyes <lists(at)natserv(dot)com>
To: pgsql General List <pgsql-general(at)postgresql(dot)org>
Subject: Check constraint
Date: 2004-03-17 12:03:04
Message-ID: 20040317115933.B13349@zoraida.natserv.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have a "comment" field in a table that I want populated if another field
has a certain value. Is it possible to set a check constraint for this?

Example:
Let's say we have fields
Purchase_type smallint check(purchase_type <4)
comment varchar

I need a check rule to something like (pseudo code)
check (if purchase_type = 3 then NOT NULL comment)

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Francisco Reyes 2004-03-17 12:55:22 Re: Check constraint
Previous Message John Sidney-Woollett 2004-03-17 06:42:26 Re: Lock inside trigger