Re: Inheritance: delete parent deletes children

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: Inheritance: delete parent deletes children
Дата
Msg-id 20021004090851.B37537-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на Inheritance: delete parent deletes children  (google.clp@alma.ch (M. I.))
Список pgsql-general
On Fri, 4 Oct 2002, M. I. wrote:

> 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?

Actually there is the SQL_INHERITANCE configuration option which
changes the default behavior (see docs).



В списке pgsql-general по дате отправления:

Предыдущее
От: "scott.marlowe"
Дата:
Сообщение: Re: transactions
Следующее
От: "scott.marlowe"
Дата:
Сообщение: Re: [HACKERS] Large databases, performance