Re: [HACKERS] about RULES - Mailing list pgsql-hackers

From Jose' Soares
Subject Re: [HACKERS] about RULES
Date
Msg-id 36A47AED.CC000243@sferacarta.com
Whole thread Raw
In response to Re: [HACKERS] about RULES  (jwieck@debis.com (Jan Wieck))
List pgsql-hackers
> 
>     In  the case of a qualified instead rule, the parsetree get's
>     splitted.  One with the qual, one with the negated  qual.  If
>     you  only  want  'SALESMAN's,  you must put the qualification
>     into the INSERT action of the rule as
> 
>     create rule "_INSvista" as on insert to vista
>         do instead
>         insert into emp select new.empno, new.ename, new.job
>         where new.job='SALESMAN';

I see that rules is more complex than I thougth. 

I tried your example Jan but it doesn't work...

create rule "_INSvista" as on insert to vista     do instead     insert into emp select new.empno, new.ename, new.job
 where new.job='SALESMAN';
 
ERROR:  Type of empno does not match target column ename

-Jose'-


pgsql-hackers by date:

Previous
From: José Paumard
Date:
Subject: Error using home-made functions
Next
From: Matthias Schmitt
Date:
Subject: different results selecting from base tables or views