about RULES

From: "Jose' Soares" <jose(at)sferacarta(dot)com>
To: "pgsql-hackers(at)postgreSQL(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: about RULES
Date: 1999-01-18 13:24:41
Message-ID: 36A33618.6E5CCB69@sferacarta.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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'-

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1999-01-18 13:26:40 Re: [HACKERS] Syntax errors in current tree
Previous Message D'Arcy J.M. Cain 1999-01-18 12:59:48 Re: [HACKERS] Syntax errors in current tree