Re: preventing deletion of a row - Mailing list pgsql-sql

From Nick Johnson
Subject Re: preventing deletion of a row
Date
Msg-id 42A537B6.8040902@notdot.net
Whole thread Raw
In response to preventing deletion of a row  (Kenneth Gonsalves <lawgon@thenilgiris.com>)
Responses Re: preventing deletion of a row  (Kenneth Gonsalves <lawgon@thenilgiris.com>)
List pgsql-sql
Kenneth Gonsalves wrote:

>hi
>i have a table of the type:
>
>id serial unique,
>name varchar(50),
>fixed boolean default FALSE
>
>if the value of 'fixed' is TRUE, then this row cannot be deleted. How 
>do i enforce this condition?
>  
>
Try this:
CREATE RULE tablename_delete AS ON DELETE TO tablename WHERE OLD.fixed = 
TRUE DO INSTEAD NOTHING;

-Nick Johnson


pgsql-sql by date:

Previous
From: Kenneth Gonsalves
Date:
Subject: datestyle syntax
Next
From: Vadivel Subramaniam
Date:
Subject: large object support in PostGres 7.4