Re: Rules on a view overwrite default values. Any way to

From: Bradley Kieser <brad(at)kieser(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PgSQL ADMIN <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Rules on a view overwrite default values. Any way to
Date: 2005-01-03 18:29:56
Message-ID: 41D98F24.3090208@kieser.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Thanks Tom and Stephan!

This works perfectly!

Brad

Tom Lane wrote:

>Bradley Kieser <brad(at)kieser(dot)net> writes:
>
>
>>The problem is that rules on a view mean that the default values for NOT
>>NULL columns (used extensively) no longer trigger!
>>
>>
>
>The way you're supposed to fix this is to attach default values to the
>view itself.
>
>ALTER TABLE myview ALTER COLUMN updated_time SET DEFAULT now();
>
>Now an INSERT on myview will include the correct expression before view
>expansion happens.
>
>I'm not sure how long we've had this, but it's definitely in 7.4.
>
> regards, tom lane
>
>
>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Chris Hoover 2005-01-03 18:53:25 How to calculate row sizes
Previous Message Amauri Pimenta 2005-01-03 18:28:10 Problems with Postgresql 8.0.0