X-Original-To: pgsql-general@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id BA0064763B4; Fri, 25 Apr 2003 13:21:29 -0400 (EDT) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by postgresql.org (Postfix) with ESMTP id 078AC476396; Fri, 25 Apr 2003 13:21:14 -0400 (EDT) Received: from [66.219.92.2] (HELO temoku) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 2986804; Fri, 25 Apr 2003 10:21:11 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Robert Treat , elein@varlena.com, elein Subject: Re: [SQL] rewriting values with before trigger Date: Fri, 25 Apr 2003 10:20:48 -0700 User-Agent: KMail/1.4.3 Cc: "pgsql-general@postgresql.org" , pgsql-sql@postgresql.org References: <1051201544.4753.522.camel@camel> <200304250033.h3P0XuDl088102@pimout1-ext.prodigy.net> <200304250003.24506.xzilla@users.sourceforge.net> In-Reply-To: <200304250003.24506.xzilla@users.sourceforge.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200304251020.48678.josh@agliodbs.com> X-Spam-Status: No, hits=-32.4 required=5.0 tests=BAYES_01,IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES, REPLY_WITH_QUOTES,USER_AGENT_KMAIL 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/1335 X-Sequence-Number: 41400 Robert, > You misunderstood. I don't think it's a bug in postgresql, it's a bug in= =20 the=20 > application that is hitting against my database. When it doesn't have a= =20 value=20 > for the timestamp field, it either needs to drop it from the insert statm= ent=20 > or convert it to null; not send a '' Incidentally, this sort of problem is why most of my apps are based on "pus= h"=20 data functions. i.e., instead of the client calling: INSERT INTO foo VALUES ( id, bar1, bar2, bar3 ); it calls SELECT df_modify_foo ( id, bar1, bar2, bar3 ); Data-push functions allow me to do a whole array of validation and custom= =20 error message return that would be impractical with triggers. It also=20 allows me to build security checks in to the back-end, via: SELECT df_modify_foo ( user_id, session_key, id, bar1, bar2, bar3 ) ... allowing me to check all of the following things: Does the user have a valid session? Does the user have rights to foo? Does the user have a lock on foo? Is this a new foo record, or a modified one? etc. --=20 -Josh Berkus Aglio Database Solutions San Francisco