"Ken Winter" <ken@sunward.org> writes:
> I have a table "person_h" with a not-null column "effective_date_and_time"
> that defaults to CURRENT_TIMESTAMP.
> I have a view "person" with the following rule defined on it:
> CREATE RULE on_insert AS
> ON INSERT TO person
> DO INSTEAD (
> INSERT INTO person_h (person_id, ...
> effective_date_and_time, ...)
You need to provide a column default on the view; the one on the
underlying table would only enter into the picture if the "INSERT INTO
person_h" command in the rule omitted specifying effective_date_and_time,
which it does not.
Use ALTER TABLE person ALTER COLUMN ... SET DEFAULT ... to attach a
default to the view.
regards, tom lane