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

From: Raymond Chui <raymond(dot)chui(at)noaa(dot)gov>
To: pgsql-general(at)postgresql(dot)org, pgsql-admin(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Why table has drop, but the foreign key still there?
Date: 2003-08-13 18:14:40
Message-ID: 3F3A8010.9030701@noaa.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general pgsql-sql


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

Why I got this error message??!!
The whitepage table already drop. When the table drop, will the
foreign key constraint also drop??

Now, order for me delete a row from state table, I HAVE TO
re-create whitepage table. That's silly!!!

What shall I do? How do I delete a row in state without
re-create the whitepage table???

Thank you very much in advance!

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Bruce Momjian 2003-08-13 18:36:01 Re: Two-fase-commit
Previous Message Wagner Sales 2003-08-13 17:37:15 Two-fase-commit

Browse pgsql-general by date

  From Date Subject
Next Message Maksim Likharev 2003-08-13 18:14:53 Re: Sorting Problem
Previous Message Bruce Momjian 2003-08-13 18:13:21 Re: Sorting Problem

Browse pgsql-sql by date

  From Date Subject
Next Message ProgHome 2003-08-13 18:29:01 Re: How to optimize this query ?
Previous Message ProgHome 2003-08-13 17:58:23 Re: How to optimize this query ?