From: | "Vladimir V(dot) Zolotych" <gsmith(at)eurocom(dot)od(dot)ua> |
---|---|
To: | pgsql-admin(at)postgresql(dot)org |
Subject: | rules bug |
Date: | 2000-04-30 06:03:30 |
Message-ID: | 390BCCB2.84926FA4@eurocom.od.ua |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
Hello all,
Have the problem with using RULEs (is it a RULE's bug?):
Do the following:
1) Create table 'num' with column of a type SERIAL, e.g.
CREATE TABLE num (id SERIAL, num INT4);
2) Create table 'num_log' (for logging insertions
in table 'num'), e.g.
CREATE TABLE num_log (num_id INT4, num_val INT4);
3) Create rule 'num_rule' (that makes logging), e.g.
CREATE RULE num_rule AS
ON INSERT TO num
DO INSERT INTO num_log VALUES (NEW.id, NEW.num);
4) Insert into 'num', e.g.
INSERT INTO num (num) VALUES (123);
5) SELECT * FROM num;
id|num
------
2|123
6) SELECT * FROM num_log;
num_id|num_val
--------------
1| 123
The problem is id != num_id, e.g. the 'id' logged with
RULE differs from real 'id' of the inserted (into table 'num')
row.
Did anybody encountered the same problem, if so how it were solved?
Is it a bug?
Thanks!
--
Vladimir Zolotych gsmith(at)eurocom(dot)od(dot)ua
From | Date | Subject | |
---|---|---|---|
Next Message | Alexander N Shulyak | 2000-04-30 12:18:52 | Re: Memorry allocation problem |
Previous Message | omid omoomi | 2000-04-30 05:32:33 | Re: Memorry allocation problem |