Re: help with table constraint / check - Mailing list pgsql-sql

From Bruno Wolff III
Subject Re: help with table constraint / check
Date
Msg-id 20030315162954.GA17488@wolff.to
Whole thread Raw
In response to help with table constraint / check  (cliff@cliffmeyers.com)
List pgsql-sql
On Sat, Mar 15, 2003 at 07:38:20 -0800, cliff@cliffmeyers.com wrote:
> 
> What I want to do is set up a constraint / check so that when a record is added,
> it takes the parent_id being passed in the INSERT statement, looks at the record
> whose fs_id equals the parent_id, and makes sure that the fs_type for that record
> is 'dir' and not 'file'.
> 
> Can I do this with standard constraints or do I need to use some PL/pgSQL
> features? Anyone have a few hints? Thanks!

One way to do this is to add a column with the parent's file system
type (constrained to be 'dir') and then make the foreign key to the parent use
both the parent ID and the file system type. 


pgsql-sql by date:

Previous
From: cliff@cliffmeyers.com
Date:
Subject: help with table constraint / check
Next
From: "Jordan S. Jones"
Date:
Subject: Retrieving Definition for Composite Type