INSERT rule

From: Darko Prenosil <darko(dot)prenosil(at)finteh(dot)hr>
To: pgsql-hackers(at)postgresql(dot)org
Subject: INSERT rule
Date: 2004-06-29 10:51:19
Message-ID: 200406291251.19171.darko.prenosil@finteh.hr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


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 !

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2004-06-29 11:23:45 Re: recursive SQL
Previous Message Hannu Krosing 2004-06-29 10:19:36 Re: Custom type with width specifier