foreign key, create table, and transactions

From: Jeffrey Green <jng15(at)columbia(dot)edu>
To: pgsql-sql(at)postgresql(dot)org
Cc: pgsql-novice(at)postgresql(dot)org
Subject: foreign key, create table, and transactions
Date: 2002-10-11 07:06:31
Message-ID: F823415B-DCE7-11D6-B141-000393675CB6@columbia.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice pgsql-sql

> Hello. I was wondering if anybody's run across the problem of
> creating tables with foreign key constraints out of order. What I
> mean by this is that say I want a table called <pictures> that has a
> foreign key reference to a table <people>. If I define pictures
> before table, I keep getting an error (Relation "people" doesn't
> exist). I tried to group them into a transaction with
>
> BEGIN;
> SET CONSTRAINTS ALL DEFERRED;
>
> CREATE TABLE pictures...
>
> CREATE TABLE people...
>
> COMMIT;
>
> But still no. Is it a requirement of postgres that all creates
> essentially be "in order" when there are foreign key constraints?
> Please cc a response to jng15 at columbia dot edu. Thanks so much.

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Chad Thompson 2002-10-11 15:55:38 Inner join syntax
Previous Message Tom Lane 2002-10-11 04:16:59 Re: Minimum permissions required for pg_dump as a backup user

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Ansley (UK) 2002-10-11 09:12:08 Re: NOTICE: generated by sequence nextval()
Previous Message Josh Berkus 2002-10-10 23:03:31 Missing Review