Quick question re foreign keys.

From: Paul Lambert <paul(dot)lambert(at)autoledgers(dot)com(dot)au>
To: pgsql-sql <pgsql-sql(at)postgresql(dot)org>
Subject: Quick question re foreign keys.
Date: 2007-10-24 02:03:01
Message-ID: 471EA7D5.9040403@autoledgers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I have a table where one column references by foreign key a column from
another table. However, the column in this first table does not always
contain data which results in a not-null constraint violation when I
attempt an insert.

My question therefore is, is it possible to create a foreign key that is
conditional, i.e. only enforce the foreign key where the value in that
table is not null.

--
Paul Lambert
Database Administrator
AutoLedgers

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Phillip Smith 2007-10-24 02:14:57 Re: Quick question re foreign keys.
Previous Message Andrew Sullivan 2007-10-23 16:46:38 Re: request for help with COPY syntax