pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Raymond Chui <raymond.chui@noaa.gov>
To: pgsql-general@postgresql.org
To: pgsql-admin@postgresql.org
To: pgsql-sql@postgresql.org
Subject: Why table has drop, but the foreign key still there?
Date: Wed, 13 Aug 2003 14:14:40 -0400
Message-ID: <3F3A8010.9030701@noaa.gov> (raw)


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!
















view thread (4+ messages)  latest in thread

Message-ID: <3F3A8010.9030701@noaa.gov>
Permalink:  ../3F3A8010.9030701@noaa.gov/
Also on:    postgresql.org/message-id/3F3A8010.9030701@noaa.gov

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: raymond.chui@noaa.gov, pgsql-general@postgresql.org, pgsql-admin@postgresql.org
  Subject: Re: Why table has drop, but the foreign key still there?
  In-Reply-To: <3F3A8010.9030701@noaa.gov>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox