Search Postgresql Archives

Re: NEW variable values in actions in rules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Ken Winter" <ken@xxxxxxxxxxx> 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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux