Re: referential integrity on existing table

From: Patrick Welche <prlw1(at)newn(dot)cam(dot)ac(dot)uk>
To: Adam Fisher <black(at)cia(dot)com(dot)au>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: referential integrity on existing table
Date: 2001-12-10 20:57:02
Message-ID: 20011210205702.G2303@quartz.newn.cam.ac.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Dec 07, 2001 at 11:00:22AM +1100, Adam Fisher wrote:
> My question is, is it possible to create a referential integrity constraint
> on an exisiting, already populated, table??

Yes, cf:

ALTER TABLE table
ADD table constraint definition

eg:

alter table "tblAddress"
add constraint addfk
foreign key("PersonID") references "tblPerson"("ID") match full;

Cheers,

Patrick

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Troy.Campano 2001-12-10 20:59:25 Help with inner/outer join
Previous Message Dado Feigenblatt 2001-12-10 20:15:21 Re: Database permissions