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'-