Re: drop table and references

From: "Martin A(dot) Marques" <martin(at)math(dot)unl(dot)edu(dot)ar>
To: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: drop table and references
Date: 2001-01-10 21:51:11
Message-ID: Pine.LNX.4.10.10101101546330.28460@math.unl.edu.ar
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 9 Jan 2001, Stephan Szabo wrote:

>
> On Tue, 9 Jan 2001, Martin A. Marques wrote:
>
> > I have a big doubt. If I drop a table with a primary key to which other
> > tables reference to, what happens? And If I create the table again, just
as
> > it was, but maybe with another column?
>
> Theoretically (ie, assuming no bugs), when you drop the table the foreign
> key constraints are dropped as well. If you recreate the table the
> constraints are not recreated, you'd have to use ALTER TABLE ADD
> CONSTRAINT to make them again.

I was talking about tables with primary keys to which foreign keys of
other tables are referenced to. Any way the primary key has to be
recreated, because the column was of type SERIAL. I'm I right?

System Administration: It's a dirty job,
but someone told I had to do it.
-----------------------------------------------------------------
Martín Marqués email: martin(at)math(dot)unl(dot)edu(dot)ar
Santa Fe - Argentina http://math.unl.edu.ar/~martin/
Administrador de sistemas en math.unl.edu.ar
-----------------------------------------------------------------

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joseph Shraibman 2001-01-10 22:10:07 Re: xml middleware
Previous Message Sandeep Joshi 2001-01-10 21:39:34 Re: Delete query