Just wrote a function that takes view name as argument and generates INSERT, 
UPDATE and DELETE rules for that view. It is working OK (thanks to Tom), but 
I have trouble with INSERT rule. 
When inserting directly into table, default values are filled in when the 
field is not in the insert target list, but when using rule system field is 
filled with NULL. I understand that rule system rewrites the query as in 
CREATE RULE expression, but can I somehow detect actual attributes that are 
inserted, and avoid forced NULL inserts ? 
        Tom said that current CVS support passing RECORD as an argument into the 
function. Is it good Idea to generate generic RULES that are simply passing 
NEW and OLD into some function, and try to solve updates inside that generic 
function ( instead of enumerating fields directly in CREATE RULE 
expression) ?

Any suggestions ?

(Sorry for bad English)
Regards !

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to