Re: Delete trigger

Поиск
Список
Период
Сортировка
От Leif Jensen
Тема Re: Delete trigger
Дата
Msg-id 1456658027.5268060.1442569958125.JavaMail.zimbra@crysberg.dk
обсуждение исходный текст
Ответ на Re: Delete trigger  (Albe Laurenz <laurenz.albe@wien.gv.at>)
Ответы Re: Delete trigger
Re: Delete trigger
Список pgsql-general
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,
butno restrictions on using the DELETE statement. 

 Leif


----- Original Message -----
> Leif Jensen wrote:
> >    If I do "DELETE FROM devicegroup WHERE group=1" I do not want to delete
> >    anything. I only want to
> > delete if I do "DELETE FROM devicegroup WHERE groupid=x AND ctrlid=y AND
> > userid=z". I don't wanna let
> > anyone delete more than 1 row at a time.
>
> I can't think of a way to do that with a trigger.
>
> I'd write a
>   FUNCTION delete_devicegroup(groupid integer, ctrlid integer, userid
>   integer)
>     RETURNS void CALLED ON NULL INPUT VOLATILE SECURITY DEFINER
> that enables the user to delete a row and checks that all arguments
> are NOT NULL.  The user doesn't get privileges to DELETE from the table
> directly.
>
> Yours,
> Laurenz Albe
>
>


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

Предыдущее
От: Albe Laurenz
Дата:
Сообщение: Re: Delete trigger
Следующее
От: Sathiyan Subramanian
Дата:
Сообщение: Re: Online backup of PostgreSQL data.