Skip site navigation (1) Skip section navigation (2)

rule on insert

From: "Razvan Radu" <razvanr(at)digiview(dot)ro>
To: <pgsql-hackers(at)hub(dot)org>
Subject: rule on insert
Date: 2000-10-28 10:55:56
Message-ID: 000e01c040cd$a9bcf420$ (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
I have a problem with a rule "on insert"
I have a table "my_table" with a field named "index"
that has a default value of "nextval('seq')"
and the folowing rule
CREATE RULE log_ins AS ON INSERT TO my_table
DO INSERT INTO log(tbl,idrow,query,time)
VALUES('my_table',NEW.index,'INSERT','now'::text) ;
my problem is:
in "log" table I have for "NEW.index" a value of 13
amd in "my_table" I have for "NEW.index" a value of 14
always (+1) which is the increment of sequence "seq"
can someone help me ?

P.S. what is the suntax for multiple actions in a rule ?


pgsql-hackers by date

Next:From: Peter EisentrautDate: 2000-10-28 12:13:23
Subject: Re: Summary: what to do about INET/CIDR
Previous:From: Tom LaneDate: 2000-10-28 05:32:19
Subject: Re: Re: [GENERAL] A rare error

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group