From: | DaVinci <bombadil(at)wanadoo(dot)es> |
---|---|
To: | Lista PostgreSql <pgsql-general(at)postgresql(dot)org> |
Subject: | Views and default values |
Date: | 2001-04-06 09:25:39 |
Message-ID: | 20010406112539.A492@fangorn.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Tim Knowles | 2001-04-06 09:44:09 | |
Previous Message | dazo | 2001-04-06 09:13:01 | ERROR: cannot read block 1452 from data (HELP!!!! I'M DESPERATE!) |