Views and default values
От | DaVinci |
---|---|
Тема | Views and default values |
Дата | |
Msg-id | 20010406112539.A492@fangorn.net обсуждение исходный текст |
Список | pgsql-general |
Hello. I have a problem (one more ;) with views, rules for inserting and default values. Data Base: create table foo ( cod serial primary key, explication text, silly bool default 't'); create view v_foo as select * from foo; create rule v_foo_ins as on insert to v_foo do instead insert into foo values ( NEW.cod, NEW.explication, NEW.silly); What is my problem with this?... It is easy to make insert in 'foo' with default value: # insert into foo(explication) values ('Because is in love'); But, what about 'v_foo'? If I make: # insert into v_foo(explication) values ('Because have not slept'); I don't get default values properly because insert rule is forcing null values. In fact, in this example I don't get nothing except an error for trying to insert null value in primary key field. Is there any way of resolving this problem?. Perhaps NEW might pass a 'default' value when it doesn't receive any data? have I lost some important concept?... Thanks. David
В списке pgsql-general по дате отправления: