delete with cascade

Поиск
Список
Период
Сортировка
Искать

delete with cascade

От:
Martín Marqués <martin@bugs.unl.edu.ar>
Дата:
I was reading the manuals on DELETE and I saw this:

By default DELETE will delete tuples in the table specified and all its 	
sub-tables. If you wish to only update the specific table mentioned, you 
should use the ONLY clause. 

I just don't understand what sub-tables means. Does it mean that it will 
delete rows on other tables which are referenced with a FOREIGN KEY to the 
row which will be deleted?

Saludos... :-)

-- 
El mejor sistema operativo es aquel que te da de comer.
Cuida tu dieta.
-----------------------------------------------------------------
Martin Marques                  |        mmarques@unl.edu.ar
Programador, Administrador      |       Centro de Telematica
                       Universidad Nacional
                            del Litoral
-----------------------------------------------------------------

Re: delete with cascade

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
=?iso-8859-1?q?Mart=EDn=20Marqu=E9s?=  writes:
> I was reading the manuals on DELETE and I saw this:
> By default DELETE will delete tuples in the table specified and all its
> sub-tables. If you wish to only update the specific table mentioned, you 
> should use the ONLY clause. 

> I just don't understand what sub-tables means.

It means inheritance children, ie, tables you created with INHERIT
from the specified table.

> Does it mean that it will 
> delete rows on other tables which are referenced with a FOREIGN KEY to the 
> row which will be deleted?

Foreign key deletion is an unrelated feature.

			regards, tom lane

Re: [GENERAL] delete with cascade

От:
Stephan Szabo <sszabo@megazone23.bigpanda.com>
Дата:

On Wed, 2 May 2001, [iso-8859-1] Mart�n Marqu�s wrote:

> I was reading the manuals on DELETE and I saw this:
> 
> By default DELETE will delete tuples in the table specified and all its 	
> sub-tables. If you wish to only update the specific table mentioned, you 
> should use the ONLY clause. 

Any table that inherit from this table.

> I just don't understand what sub-tables means. Does it mean that it will 
> delete rows on other tables which are referenced with a FOREIGN KEY to the 
> row which will be deleted?

Only if you defined the foreign key with ON DELETE CASCADE.

FAQ