Re: Why table has drop, but the foreign key still there?

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Raymond Chui <raymond(dot)chui(at)noaa(dot)gov>
Cc: <pgsql-general(at)postgresql(dot)org>, <pgsql-admin(at)postgresql(dot)org>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Why table has drop, but the foreign key still there?
Date: 2003-08-13 19:38:29
Message-ID: 20030813123631.I55790-100000@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general pgsql-sql


On Wed, 13 Aug 2003, Raymond Chui wrote:

>
> Here are the simple things I did
>
> create table state (
> state_code char(2) not null,
> state varchar(15) not null,
> primary key (state_code)
> );
>
> create table whitepage (
> user_id char(8) not null,
> email varchar(50),
> telephone char(16) not null,
> contact_name varchar(30) not null,
> city varchar(20),
> state_code char(2),
> primary key (user_id),
> foreign key (state_code) references state (state_code)
> );
>
>
> insert into state (state_code,state) values ('GU','Guam');
> drop table whitepage;
> delete from state where state_code = 'GU';
> ERROR: Relation "whitepage" does not exist

What version are you using? I can't seem to replicate this given the
above on 7.2, 7.3 or 7.4.

If these tables were preexisting and had gone through a dump cycle
from 7.0 or 7.1, there was a bug in pg_dump for those versions that
would lose the connection between the triggers and the other table
of the constraint.

In any case, you'll need to find and drop the two orphaned triggers on
state (see techdocs for information on how to find them).

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2003-08-13 19:53:03 Re: Why table has drop, but the foreign key still there?
Previous Message =?iso-8859-1?q?Aur=E9lien_DEHAY?= 2003-08-13 18:41:25 Re: Two-fase-commit

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-08-13 19:53:03 Re: Why table has drop, but the foreign key still there?
Previous Message Tom Lane 2003-08-13 19:29:21 Re: Help! Can't pg_dump anything: handler procedure for procedural language plpgsql not found

Browse pgsql-sql by date

  From Date Subject
Next Message Rod Taylor 2003-08-13 19:50:16 Re: Porting from PL/SQL to PLPGSQL
Previous Message Josh Berkus 2003-08-13 19:35:23 Re: Porting from PL/SQL to PLPGSQL