Re: INSERT rule

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Darko Prenosil <darko(dot)prenosil(at)finteh(dot)hr>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: INSERT rule
Date: 2004-06-29 14:18:54
Message-ID: 28999.1088518734@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Darko Prenosil <darko(dot)prenosil(at)finteh(dot)hr> writes:
> 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.

You want to attach the defaults directly to the view, viz
ALTER TABLE view ALTER COLUMN col SET DEFAULT whatever;

regards, tom lane

In response to

  • INSERT rule at 2004-06-29 10:51:19 from Darko Prenosil

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Darko Prenosil 2004-06-29 17:17:01 Re: INSERT rule
Previous Message Fabien COELHO 2004-06-29 13:45:32 Re: Tablespace permissions issue