Re: Inheritance: delete parent deletes children

From: "M(dot) I(dot)" <google(dot)clp(at)alma(dot)ch>
To: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>,
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Inheritance: delete parent deletes children
Date: 2002-10-04 16:04:05
Message-ID: 5.1.0.14.2.20021004175249.02e60d30@net1.alma.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

At 17.37 04.10.02, Stephan Szabo wrote:

>On 2 Oct 2002, M. I. wrote:
>
> > But I just realized that things actually go into that "logging" table,
> > not into the child tables. I wonder how the database knows which row
> > in logging is related to which row in a child table.
>
>Well, selects, inserts, updates, deletes by default go through the
>inheritance tree if you do them on a parent, so select * from
>logging will show rows from the child tables. You can use ONLY
>to turn off that behavior (select * from ONLY logging) should
>show rows only in that particular table and not the children.

Oh, I see. Yes, it seems to make sense.

But the Delete is scary. It looks like I could inadvertently empty the
whole database with a DELETE FROM logging; if I forget that it
happens to have (many) children.

The day I die, I certainly hope my children will survive me :-) ...

Is there something I can do with rules, to protect me from this
"exterminator" attitude of the database?

Thank you for your help,

Mi

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message scott.marlowe 2002-10-04 16:05:10 Re: [HACKERS] Large databases, performance
Previous Message Luke Myers 2002-10-04 15:58:45 ??? Is posgresql.org no longer maintained ???