about RULES - Mailing list pgsql-hackers

From Jose' Soares
Subject about RULES
Date
Msg-id 36A33618.6E5CCB69@sferacarta.com
Whole thread Raw
Responses Re: [HACKERS] about RULES  (jwieck@debis.com (Jan Wieck))
List pgsql-hackers
Hi all,

I have a question about rules. I create a rule to insert data into a
view that works fine,
but when I add a row to the view, PostgreSQL replies INSERT 0 0 if the
row is added and it replies
INSERT oid# 1 if the row is not added.
I have the same behavior with RULES on UPDATE and on DELETE. 

Here the example:


create rule "_RIT_vista" as on insert to vista   where new.job='SALESMAN'   do instead   insert into emp
(empno,ename,job)values
 
(new.empno,new.ename,new.job);
CREATE

insert into vista values ('8900','MANUEL','SALESMAN');
INSERT 0 0        <<<<<<<<<<------------------------- Why it replies
INSERT 0 0 if it adds the row ?
^^^^^^^^^^^

select * from vista;
empno|ename     |job
-----+----------+------------8900|MANUEL    |SALESMAN
(1 row)

insert into vista values ('8901','JOSE','PROGRAMMER');
INSERT 144991 1    <<<<<<<<<------------------------- Why it replies
INSERT oid 1 if it adds no row?
^^^^^^^^^^^^^^^

select * from vista;
empno|ename     |job
-----+----------+------------8900|MANUEL    |SALESMAN
(1 row)

select oid,* from emp;  oid|ename     |empno|job         |hiredate|sal|comm|deptno|level|mgr
------+----------+-----+------------+--------+---+----+------+-----+---
144990|MANUEL    | 8900|SALESMAN    |        |   |    |      |     |
(1 row)

Any ideas ?

-Jose'-


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] I need a PostgreSQL vacation
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] Syntax errors in current tree