Re: Delete trigger

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Leif Jensen <leif(at)crysberg(dot)dk>
Cc: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>, Charles Clavadetscher <clavadetscher(at)swisspug(dot)org>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Delete trigger
Date: 2015-09-18 12:47:15
Message-ID: CAKFQuwYwmPvgA3F=cPL5_d+PO4psg2KhKq-aTm71fNZSBAt3NQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Friday, September 18, 2015, Leif Jensen <leif(at)crysberg(dot)dk> wrote:

> Hello Laurenz,
>
> Thank you for you suggestion. I really want to aviod that someone
> 'accidentally' deletes too much by typing (programming) a not full
> qualified DELETE ... statement. In your case one would have to always use
> the delete function, but no restrictions on using the DELETE statement.
>
>
There is no way you can prevent a superuser from shooting themselves in the
foot. For anyone else you can enforce use of the function to perform the
delete.

You could make a field called ok-to-delete and add a partial unique index
on it so that only a single record can be marked ok to delete at a time and
then have your trigger abort if it tries to delete a field without the ok
to delete field set to true.

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Leif Jensen 2015-09-18 13:06:14 Re: Delete trigger
Previous Message Ioana Danes 2015-09-18 12:14:55 Re: Delete trigger