drop table and references

Started by Martin A. Marquesabout 25 years ago5 messagesgeneral
Jump to latest
#1Martin A. Marques
martin@math.unl.edu.ar

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?

Saludos... ;-)

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

#2Miles Thompson
milesthompson@sprint.ca
In reply to: Martin A. Marques (#1)
Re: drop table and references

Nooooooooooooooooooooooooooooooooo!

If the primary key of that table is foreign key for other tables they have
nothing to refer to. It would be like stripping surnames from people in a
large city.

Regards - Miles Thompson

PS Have you checked the SQL sites which have tutorials on denormalization
of data?
/mt

At 05:28 PM 01/09/2001 -0300, Martin A. Marques wrote:

Show quoted text

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?

Saludos... ;-)

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

#3Giovanni Serrato Castillo
gserrato@sager.telecom-co.net
In reply to: Miles Thompson (#2)
My pgAdmin is very slow...

My pgAdmin is very slow. Help me please.

Regards.

Giovanni Serrato

#4Stephan Szabo
sszabo@megazone23.bigpanda.com
In reply to: Martin A. Marques (#1)
Re: drop table and references

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.

#5Martin A. Marques
martin@math.unl.edu.ar
In reply to: Stephan Szabo (#4)
Re: drop table and references

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@math.unl.edu.ar
Santa Fe - Argentina http://math.unl.edu.ar/~martin/
Administrador de sistemas en math.unl.edu.ar
-----------------------------------------------------------------