Skip site navigation (1) Skip section navigation (2)

Re: add foreign key constraint after table creation?

From: Nabil Sayegh <nas(at)e-trolley(dot)de>
To: Rory Campbell-Lange <rory(at)campbell-lange(dot)net>
Cc: Postgresql Novice List <pgsql-novice(at)postgresql(dot)org>
Subject: Re: add foreign key constraint after table creation?
Date: 2003-05-26 19:46:00
Message-ID: 1053978360.699.8.camel@billy (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
Am Mon, 2003-05-26 um 20.21 schrieb Rory Campbell-Lange:

> My problem is that I cannot load my full table schema using \i as to
> define peopel I need objects defined and vice versa. To get around this
> I though I could define the foreign key constraint on people.n_object_id
> after I had loaded everything. How do I do it? The alter table \h
> command isn't very helpful!

I'm not sure but you could try opening a transaction (BEGIN) before the
inserts and COMMIT it at the end.
AFAIR that way it's possible to have the constraints checked at the end.

 e-Trolley Sayegh & John, Nabil Sayegh
 Tel.: 0700 etrolley /// 0700 38765539
 Fax.: +49 69 8299381-8
 PGP :

In response to

pgsql-novice by date

Next:From: Josh BerkusDate: 2003-05-26 23:40:57
Subject: Re: Functions or Rules and Views?
Previous:From: Rory Campbell-LangeDate: 2003-05-26 18:21:33
Subject: add foreign key constraint after table creation?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group