pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bradley Kieser <brad@kieser.net>
Cc: PgSQL ADMIN <pgsql-admin@postgresql.org>
Subject: Re: Rules on a view overwrite default values. Any way to reinstate them?
Date: Mon, 03 Jan 2005 12:32:18 -0500
Message-ID: <24511.1104773538@sss.pgh.pa.us> (raw)
In-Reply-To: <41D97A9C.6050401@kieser.net>
References: <41D97A9C.6050401@kieser.net>

Bradley Kieser <brad@kieser.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



view thread (7+ messages)  latest in thread

Message-ID: <24511.1104773538@sss.pgh.pa.us>
Permalink:  ../24511.1104773538@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/24511.1104773538@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, brad@kieser.net
  Subject: Re: Rules on a view overwrite default values. Any way to reinstate them?
  In-Reply-To: <24511.1104773538@sss.pgh.pa.us>
  References: <41D97A9C.6050401@kieser.net> <24511.1104773538@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox