Received: from zukerman-1.dsl.speakeasy.net (zukerman-1.dsl.speakeasy.net [216.254.75.142]) by hub.org (8.10.1/8.10.1) with ESMTP id e6RFCsA33574 for ; Thu, 27 Jul 2000 11:12:55 -0400 (EDT) Received: from (matt.w80.math-hat.com) [216.254.75.141] by zukerman-1.dsl.speakeasy.net with esmtp (Exim 3.12 #1 (Debian)) id 13HpL3-0000Rf-00; Thu, 27 Jul 2000 11:12:45 -0400 Received: from zukerman by matt.w80.math-hat.com with local (Exim 3.12 #1 (Debian)) id 13HpLC-0000lr-00 for ; Thu, 27 Jul 2000 11:12:54 -0400 From: Itai Zukerman To: pgsql-sql@postgresql.org Subject: Automatic Deletes? Message-Id: Date: Thu, 27 Jul 2000 11:12:54 -0400 X-Archive-Number: 200007/259 Hi, I have: CREATE TABLE a ( id SERIAL, val INT4 ) ; I would like to create some rules to keep "a" free from rows where val == 0. Something like: CREATE RULE a_insert AS ON INSERT TO a WHERE NEW.val = 0 DO INSTEAD NOTHING ; CREATE RULE a_update AS ON UPDATE TO a WHERE NEW.val = 0 DO INSTEAD DELETE FROM a WHERE id = NEW.id ; Does this look right? I think there should be a better way to express the second rule... Thanks, -itai