Re: help with add constraint syntax needed

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Mike Haberman <mikeh(at)ncsa(dot)uiuc(dot)edu>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: help with add constraint syntax needed
Date: 2001-06-22 19:51:08
Message-ID: Pine.BSF.4.21.0106221248000.9504-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On Wed, 20 Jun 2001, Mike Haberman wrote:

> hello all,
>
> I am using an xml -> sql generator where foreign key are specified
> after the columns are. The sql is written as the xml file is being
> parsed so, the foreign key stuff must be written after the fact.
>
> The problem I need to solve is adding the on Delete/on Update constraints.
>
> here's what I would like to do (e.g.):
>
> ALTER TABLE league
> ADD CONSTRAINT leagueOwnerId FOREIGN KEY (leagueOwnerId)
> REFERENCES TeamOwner (id) ON DELETE CASCASE;
>
> table teamOwner (id)
> table league (id, leagueOwnerId)
> where leagueOwnerId is a FKey to owner(id)

What problem are you having? The above works for me assuming teamowner
has a unique constraint on id on current sources.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Joseph Weinstein 2001-06-22 19:53:29 Re: JDBC Connection State Management with SQL Exceptions (esp Postgresql)
Previous Message Daniel Åkerud 2001-06-22 19:16:57 Re: Multiple Indexing, performance impact