Re: Possible problems with cyclic references

Поиск
Список
Период
Сортировка
От Jan Wieck
Тема Re: Possible problems with cyclic references
Дата
Msg-id 200107231418.f6NEIRi23924@jupiter.us.greatbridge.com
обсуждение исходный текст
Ответ на Possible problems with cyclic references  (Gary Stainburn <gary.stainburn@ringways.co.uk>)
Ответы Re: Possible problems with cyclic references  (Gary Stainburn <gary.stainburn@ringways.co.uk>)
Список pgsql-sql
Gary Stainburn wrote:
> Hi all, me again.
>
> I've been looking at the doc's again (must stop doing that!)
>
> I've been looking at the 'references' clause to implement referential
> integrity.  My problem is that I'm wanting to create a cyclic reference, and
> was wondering what problems this may cause, e.g. when restoring from a
> pg_dump.
>
> I have a region table (rregion character(2), rname varchar(40), rliasson
> int4).
> I have a teams table (ttid int4, tregion character(2) references
> region(rregion),...)
> I have a members table (mid int4, mteam references teams(tid),.........)
>
> Pretty straight forward so far, a member must be a part of a team and a team
> must be in a region.  My problem is that I want to set rliasson as a
> reference to members (mid) as the Regional Liasson Officer for each region is
> a member.
   No  problem.  pg_dump outputs commands to disable referential   integrity checks during the restore.
   And you could even make rliasson NOT NULL. All you have to do   then is to have the constraints INITIALLY DEFERRED
andinsert   all the cyclic rows in one transaction.
 
   Add the constraint to the region table with ALTER TABLE after   creating the members table.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com



В списке pgsql-sql по дате отправления:

Предыдущее
От: domingo@dad-it.com (Domingo Alvarez Duarte)
Дата:
Сообщение: unique index on more than one field using functions
Следующее
От: "Ed Yu"
Дата:
Сообщение: Re: When PostgreSQL compliant JDBC 2.0?