pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: cliff@cliffmeyers.com
Cc: pgsql-sql@postgresql.org
Subject: Re: help with table constraint / check
Date: Sat, 15 Mar 2003 10:29:54 -0600
Message-ID: <20030315162954.GA17488@wolff.to> (raw)
In-Reply-To: <20030315073820.3084.h016.c001.wm@mail.cliffmeyers.com.criticalpath.net>
References: <20030315073820.3084.h016.c001.wm@mail.cliffmeyers.com.criticalpath.net>

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. 



view thread (2+ messages)

Message-ID: <20030315162954.GA17488@wolff.to>
Permalink:  ../20030315162954.GA17488@wolff.to/
Also on:    postgresql.org/message-id/20030315162954.GA17488@wolff.to

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: bruno@wolff.to, cliff@cliffmeyers.com
  Subject: Re: help with table constraint / check
  In-Reply-To: <20030315162954.GA17488@wolff.to>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox