X-Original-To: pgsql-general@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 3AE44475E9D; Thu, 24 Apr 2003 14:38:35 -0400 (EDT) Received: from localhost.localdomain (unknown [65.217.53.66]) by postgresql.org (Postfix) with ESMTP id 65848474E42; Thu, 24 Apr 2003 14:38:33 -0400 (EDT) Received: from thorn.mmrd.com (thorn.mmrd.com [172.25.10.100]) by localhost.localdomain (8.12.8/8.12.8) with ESMTP id h3OJKFF0026611; Thu, 24 Apr 2003 15:20:16 -0400 Received: from gnvex001.mmrd.com (gnvex001.mmrd.com [192.168.3.55]) by thorn.mmrd.com (8.11.6/8.11.6) with ESMTP id h3OIcFx10169; Thu, 24 Apr 2003 14:38:15 -0400 Received: from camel.mmrd.com ([172.25.5.213]) by gnvex001.mmrd.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id 2YCPW2TC; Thu, 24 Apr 2003 14:38:13 -0400 Subject: Re: [SQL] rewriting values with before trigger From: Robert Treat To: Josh Berkus Cc: "pgsql-general@postgresql.org" , pgsql-sql@postgresql.org In-Reply-To: <200304240939.54070.josh@agliodbs.com> References: <1051201544.4753.522.camel@camel> <200304240939.54070.josh@agliodbs.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 24 Apr 2003 14:38:14 -0400 Message-Id: <1051209495.7747.544.camel@camel> Mime-Version: 1.0 X-Spam-Status: No, hits=-38.0 required=5.0 tests=BAYES_10,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REFERENCES,REPLY_WITH_QUOTES,USER_AGENT_XIMIAN autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/1257 X-Sequence-Number: 41322 On Thu, 2003-04-24 at 12:39, Josh Berkus wrote: > Robert, > > > Is there anyway to do be able to change the '' into NULL before data > > validity is checked with a trigger? > > What about using a RULE instead? > RULE's follow this same behavior, erroring out if the data is not a valid timestamp. (At least I've not been able to write a rule that doesn't follow this) In fact you actually can't create the rule if you have a where clause that isn't a proper matching datatype. I seem to recall a solution for folks who need '' to represent 0 in int fields was to use triggers or rules, but I guess that really isn't possible :-( Robert Treat