Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28]) by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f1GIQDx37439 for ; Fri, 16 Feb 2001 13:26:13 -0500 (EST) (envelope-from pgsql-sql-owner@postgresql.org) Received: from news.tht.net (news.hub.org [216.126.91.242]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f1ENV4x96691 for ; Wed, 14 Feb 2001 18:31:04 -0500 (EST) (envelope-from news@news.tht.net) Received: (from news@localhost) by news.tht.net (8.11.1/8.11.1) id f1ENN4i70755 for pgsql-sql@postgresql.org; Wed, 14 Feb 2001 18:23:04 -0500 (EST) (envelope-from news) From: Dan McGrath X-Newsgroups: comp.databases.postgresql.sql Subject: Re: Trigger question Date: Wed, 14 Feb 2001 18:20:09 -0500 Organization: Hub.Org Networking Services (http://www.hub.org) Lines: 30 Message-ID: <3A8B12A9.416F51A3@home.com> References: <3A8754BB.382CBDBE@wedwick.com> <3A8A9EF5.8C8929C@wedwick.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: scrappy@hub.org To: Dave Wedwick X-Mailer: Mozilla 4.76 [en] (Windows NT 5.0; U) X-Accept-Language: en To: pgsql-sql@postgresql.org X-Archive-Number: 200102/284 X-Sequence-Number: 1475 Actually, a default of now() would be perfectly providing you created a rule to trap insert's and updates and remove the setting for that time/date from being inserted so as to have the db use the dfault which I think is far easier that making a silly trigger for something so simple. Dan Dave Wedwick wrote: > One person suggested setting now() as default. > > That would work sometimes, but I have a situation where the user program is > updating the default field with 0. now() never gets into the field. > > So, regardless of what the user enters, I want now() to be updated, and I > guess it would be via a trigger... > > Thanks! > > Dave Wedwick wrote: > > > Hi! > > > > I have a table with an int4 field called inserttime. Regardless of what > > the user enters in this field, I want a trigger to put now() into it. > > > > What's the syntax for the trigger? > > > > Thanks!