Received: from oberon.dnai.com (oberon.dnai.com [207.181.194.97]) by hub.org (8.9.3/8.9.3) with ESMTP id RAA25673 for ; Mon, 2 Aug 1999 17:07:16 -0400 (EDT) (envelope-from mo@local2me.com) Received: from local2me.com (dnai-216-15-121-13.dialup.dnai.com [216.15.121.13]) by oberon.dnai.com (8.9.3/8.9.3) with ESMTP id OAA10137 for ; Mon, 2 Aug 1999 14:06:45 -0700 (PDT) Sender: michael@oberon.dnai.com Message-ID: <37A607FA.E9727ABD@local2me.com> Date: Mon, 02 Aug 1999 14:04:58 -0700 From: Michael Olivier X-Mailer: Mozilla 4.6 [en] (X11; I; Linux 2.2.5-22 i686) X-Accept-Language: en MIME-Version: 1.0 To: "pgsql-sql@postgreSQL.org" Subject: few questions about rules: timestamp, new.oid Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi, I am setting up rules to track changes to some tables, in PG 6.4.2-3 (RH Linux 6.0) ... and have two questions: 1. I'm storing a datetime timestamp for when the change was entered into my changes table, but the timestamp doesn't change with subsequent tests: create rule users_modify_rule as on update to users do insert into changes (table_name, change_time, ref_oid, type) values ('users', 'now', current.oid, 'update'); dmtest=> select * from changes; table_name|change_time |ref_oid|ref_name|type ----------+----------------------------+-------+--------+------ users |Mon Aug 02 13:52:34 1999 PDT| 990398| |update users |Mon Aug 02 13:52:34 1999 PDT| 990398| |update users |Mon Aug 02 13:52:34 1999 PDT| 990398| |update users |Mon Aug 02 13:52:34 1999 PDT| 990398| |update users |Mon Aug 02 13:52:34 1999 PDT| 990398| |update (5 rows) 2. How can I get the oid of a record being inserted? Using new.oid isn't getting it for me... the field in my changes table remains blank... create rule users_add_rule as on insert to users do insert into changes (table_name, change_time, ref_oid, type) values ('users', 'now', new.oid, 'insert'); Getting some other field, like new.acctname, does work... Thanks, Michael