Re: Adding foreign key constraints without integrity check?

Поиск
Список
Период
Сортировка
Искать
От
Florian G. Pflug
Тема
Re: Adding foreign key constraints without integrity check?
Дата
Msg-id
449728BE.4080005@phlo.org
Ответ на
Список
Дерево обсуждения
Adding foreign key constraints without integrity check? Wes <wespvp@syntegra.com>
Re: Adding foreign key constraints without integrity Scott Marlowe <smarlowe@g2switchworks.com>
Re: Adding foreign key constraints without integrity Wes <wespvp@syntegra.com>
Re: Adding foreign key constraints without integrity check? "Florian G. Pflug" <fgp@phlo.org>
Re: Adding foreign key constraints without integrity Wes <wespvp@syntegra.com>
Re: Adding foreign key constraints without integrity check? "Florian G. Pflug" <fgp@phlo.org>
Re: Adding foreign key constraints without integrity check? louis gonzales <gonzales@linuxlouis.net>
Re: Adding foreign key constraints without integrity check? "Florian G. Pflug" <fgp@phlo.org>
Re: Adding foreign key constraints without integrity check? louis gonzales <gonzales@linuxlouis.net>
Re: Adding foreign key constraints without integrity check? Bruno Wolff III <bruno@wolff.to>
Re: Adding foreign key constraints without integrity check? louis gonzales <gonzales@linuxlouis.net>
Re: Adding foreign key constraints without integrity check? "Florian G. Pflug" <fgp@phlo.org>
Re: Adding foreign key constraints without integrity Wes <wespvp@syntegra.com>
Re: Adding foreign key constraints without integrity check? "Florian G. Pflug" <fgp@phlo.org>
Re: Adding foreign key constraints without integrity Wes <wespvp@syntegra.com>
Re: Adding foreign key constraints without integrity Jim Nasby <jnasby@pervasive.com>
Re: Adding foreign key constraints without integrity Wes <wespvp@syntegra.com>
Re: Adding foreign key constraints without integrity check? Jan Wieck <JanWieck@Yahoo.com>
Lock changes with 8.1 - what's the right lock? Wes <wespvp@syntegra.com>
Re: Lock changes with 8.1 - what's the right lock? Michael Fuhr <mike@fuhr.org>
Re: Adding foreign key constraints without integrity check? Tom Lane <tgl@sss.pgh.pa.us>
Re: Adding foreign key constraints without integrity Wes <wespvp@syntegra.com>
Re: Adding foreign key constraints without integrity Jim Nasby <jnasby@pervasive.com>
Re: Adding foreign key constraints without integrity Wes <wespvp@syntegra.com>
Re: Adding foreign key constraints without integrity Scott Marlowe <smarlowe@g2switchworks.com>
Re: Adding foreign key constraints without integrity Wes <wespvp@syntegra.com>
Re: Adding foreign key constraints without integrity Wes <wespvp@syntegra.com>
Re: Adding foreign key constraints without integrity Wes <wespvp@syntegra.com>
louis gonzales wrote:
> Florian,
> Are you certain:
> 
> "You can only create an FK if the fields you are referencing in the 
> foreign table form a PK there. And creating a PK implicitly creates an 
> index, which you can't drop without dropping the PK :-("
> 
Arg.. Should have written "unique index" instead of primary key..
But it doesn't change much, since a unique index and a pk are nearly
the same.

> I'm not sure I am convinced the necessity of a foreign key, "needing" to 
> reference a primary keyed entry from a different table.
I tried the following:
create table a(id int4) ;
create table b(id int4, a_id int4) ;
alter table b add constraint pk foreign key (a_id) references a (id) ;

The alter table gave me an error stating that I need to have a unique index
defined on a.id...

greetings, Florian Pflug
В списке pgsql-general по дате отправления
От: Jerry LeVan
Дата:
Сообщение: psql for winxp?
От: Casey Duncan
Дата:
Сообщение: Re: Cannot restart postgres
FAQ