Re: Batch Table Creation - Foreign Key Problem

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Daniel Whelan <merlin(at)ophelan(dot)com>, pgsql-novice(at)postgresql(dot)org
Subject: Re: Batch Table Creation - Foreign Key Problem
Date: 2002-12-17 01:16:30
Message-ID: 200212161716.30287.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Daniel,

> I'm trying to create a set of tables, some of which have a foreign key
> pointing to other tables in the same set. The problem arises when it
> tries to add a table before the table it depends on has been created. Is
> there any way to defer the checking of foreign key dependancies until
> after the whole transaction block?
>
> Alternately, would I be better off creating the tables with no foreign
> keys, and issuing alter statements at the end to add the keys? Thanks!

Yes, probably. Take a look at how this is handled in pg_dump files for
version 7.2.2 and higher.

--
-Josh Berkus
Aglio Database Solutions
San Francisco

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Scott Taylor 2002-12-17 09:32:39 Re: [JDBC] JDBC - Open Office
Previous Message Brian Scandale 2002-12-16 22:11:11 Re: Redhat Database ???